private void Rpt_Pedido() { try { //Se crea el documento PDF PdfDocument document = new PdfDocument(); //Se configura los datos dela pagina document.Info.Title = "»» PEDIDO ««"; document.Info.Author = "HVR"; //Se crea la pagina A4 PdfPage page = document.AddPage(); page.Orientation = PageOrientation.Portrait; //Se crea el objeto dibujo XGraphics gfx = XGraphics.FromPdfPage(page); XPen pen = new XPen(XColors.Navy, 1); string anio = Convert.ToString(DateTime.Now).Substring(6, 10); XRect rect; XFont fontB18 = new XFont("Abadi MT Condensed Light", 20, XFontStyle.Bold); XFont fontB12 = new XFont("Abadi MT Condensed Light", 12, XFontStyle.Bold); XFont fontB9 = new XFont("Abadi MT Condensed Light", 9, XFontStyle.Bold); XFont font9 = new XFont("Abadi MT Condensed Light", 9); XFont font; XFont font2; XTextFormatter tf = new XTextFormatter(gfx); //define margins double leftMargin = 40.0; double rightMargin = 570.0; double topMargin = 20.0; double lineTop = 0d; double lineFooter = 780d; double rowStep = 12d; double newRow = topMargin + rowStep; double beginRow = newRow; double currentRow = beginRow; double currentRowCol2 = 0; double firstCustomerRow = 100d; double txtShift = 8d; string hcString = string.Empty; //---added 6-26-13 string sim1 = "["; string sim2 = "]"; string space = " "; #region OBTENIENDO VALORES DE SESSION // DECLARANDO VARIBALES QUE RECIBIMOS DE SESSION string XEMPRESANAME = Session["ssEmpresaName"].ToString(); string XEMPRESARUC = Session["ssEmpresaRuc"].ToString(); string XGERENTEGENE = Session["ssGerenteGeneral"].ToString(); string XGERENTEDNI = Session["ssGerenteNrodni"].ToString(); string XPARTELECTRO = Session["ssPartElectro"].ToString(); Double XIMPOBRUTO = 0, XIMPONETO = 0; string XNUMDOC = "", XSERDOC = "", XTASADESCTO = "", XPLAZODAY = "", XNUMDOCS = "", XMEDIOPAGO = "", XNDIAS = "", XVENDORNAME = "", XCTACTENAME = "", XCLINMRUC = "", XDIREC = "", XDIRECENTREGA = "", XREPLEGALNAME = "", XREPLEGALDNI = "", XFECHA = "", XCO = "", XCR = "", XNMONE = "", XIGV = ""; //VARIABLES RECIEN AGREGADAS EN LA BD string XREGPUBLICO = "", XPARTELECTRO2 = "", XESTCIVIL = ""; tb_cxc_pedidocabBL BL = new tb_cxc_pedidocabBL(); tb_cxc_pedidocab BE = new tb_cxc_pedidocab(); DataTable TablaProfor = new DataTable(); BE.tipdoc = Session["xtipdoc"].ToString(); BE.serdoc = Session["xserdoc"].ToString(); BE.numdoc = Session["xnumdoc"].ToString(); TablaProfor = BL.GetAll2(Session["ssEmpresaID"].ToString(), BE).Tables[0]; foreach (DataRow fila in TablaProfor.Rows) { XNUMDOC = fila["numdoc"].ToString(); XSERDOC = fila["serdoc"].ToString(); XTASADESCTO = fila["tasadescto"].ToString(); XPLAZODAY = fila["plazoday"].ToString(); XNUMDOCS = fila["numdocs"].ToString(); XMEDIOPAGO = fila["descripcion"].ToString(); XNDIAS = fila["ndias"].ToString(); XVENDORNAME = fila["vendorname"].ToString(); XCTACTENAME = fila["ctactename"].ToString(); XCLINMRUC = fila["nmruc"].ToString(); XDIREC = fila["direc"].ToString(); XDIRECENTREGA = fila["direc_entrega"].ToString(); XREPLEGALNAME = fila["replegal_name"].ToString(); XREPLEGALDNI = fila["replegal_dni"].ToString(); XFECHA = fila["fechdoc"].ToString(); if (fila["condventaid"].ToString() == "02") XCR = "X"; else XCO = "X"; XNMONE = fila["precios"].ToString(); XIGV = fila["incluye_igv"].ToString(); XREGPUBLICO = fila["regpublico"].ToString(); XPARTELECTRO2 = fila["partelectro"].ToString(); XESTCIVIL = fila["estcivil"].ToString(); XIMPOBRUTO = Convert.ToDouble(fila["impobruto"].ToString()); XIMPONETO = Convert.ToDouble(fila["imponeto"].ToString()); } #endregion #region HOJA 01 // TITULO //gfx.DrawString("EMPRESA", fontB9, XBrushes.Black, leftMargin, topMargin + 20); //gfx.DrawString(": " + XEMPRESANAME, font9, XBrushes.Black, leftMargin + 30, topMargin + 20); gfx.DrawString("CANAL DE VENTAS", fontB9, XBrushes.Black, leftMargin, topMargin + 30); gfx.DrawString(": " + "VENTAS HORIZONTALES", font9, XBrushes.Black, leftMargin + 60, topMargin + 30); //gfx.DrawString("RUC", fontB9, XBrushes.Black, leftMargin, topMargin + 40); //gfx.DrawString(": " + XEMPRESARUC, font9, XBrushes.Black, leftMargin + 30, topMargin + 40); gfx.DrawString("PEDIDOS", fontB12, XBrushes.Black, leftMargin + 230, topMargin + 20); pen = new XPen(XColors.Black, 2); gfx.DrawRoundedRectangle(pen, leftMargin + 400, topMargin + 10, 140, 30, 15, 15); // CUADRO gfx.DrawString("PEDIDO", fontB9, XBrushes.Black, leftMargin + 410, topMargin + 20); gfx.DrawString(": PD-" + Session["xnumdoc"].ToString(), font9, XBrushes.Black, leftMargin + 450, topMargin + 20); gfx.DrawString("FECHA", fontB9, XBrushes.Black, leftMargin + 410, topMargin + 30); gfx.DrawString(": " + Equivalencias.Left(XFECHA, 10), font9, XBrushes.Black, leftMargin + 450, topMargin + 30); font = new XFont("Abadi MT Condensed Light", 10, XFontStyle.Bold); font2 = new XFont("Abadi MT Condensed Light", 9); gfx.DrawString("VENDEDOR", font, XBrushes.Black, new XRect(leftMargin, topMargin + 50, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XVENDORNAME + "", font2, XBrushes.Black, new XRect(leftMargin + 40, topMargin + 50, 10, 10), XStringFormats.TopLeft); gfx.DrawString("CLIENTE", font, XBrushes.Black, new XRect(leftMargin, topMargin + 60, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XCTACTENAME + "", font2, XBrushes.Black, new XRect(leftMargin + 40, topMargin + 60, 10, 10), XStringFormats.TopLeft); gfx.DrawString("RUC", font, XBrushes.Black, new XRect(leftMargin, topMargin + 70, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XCLINMRUC + "", font2, XBrushes.Black, new XRect(leftMargin + 40, topMargin + 70, 10, 10), XStringFormats.TopLeft); gfx.DrawString("DIRECC", font, XBrushes.Black, new XRect(leftMargin, topMargin + 80, 10, 10), XStringFormats.TopLeft); rect = new XRect(leftMargin + 40, topMargin + 80, 200, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString(": " + XDIREC + "", font2, XBrushes.Black, rect, XStringFormats.TopLeft); gfx.DrawString("DIR ENTREGA", font, XBrushes.Black, new XRect(leftMargin, topMargin + 100, 10, 10), XStringFormats.TopLeft); //gfx.DrawString(": " + XDIRECENTREGA + "", font2, XBrushes.Black, new XRect(leftMargin + 60, topMargin + 100, 10, 10), XStringFormats.TopLeft); rect = new XRect(leftMargin + 60, topMargin + 100, 200, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString(": " + XDIRECENTREGA + "", font2, XBrushes.Black, rect, XStringFormats.TopLeft); gfx.DrawString("NUM-CONTRATO", font, XBrushes.Black, new XRect(leftMargin, topMargin + 110, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XNUMDOC + "", font2, XBrushes.Black, new XRect(leftMargin + 60, topMargin + 110, 10, 10), XStringFormats.TopLeft); gfx.DrawString("COND-VENTA : ", font, XBrushes.Black, new XRect(leftMargin, topMargin + 120, 10, 10), XStringFormats.TopLeft); // DIBUJAR UN RECTANGULO pen = new XPen(XColors.Black, 2); gfx.DrawRoundedRectangle(pen, leftMargin + 57, topMargin + 125, 90, 30, 25, 25); gfx.DrawString("CONTADO", font, XBrushes.Black, new XRect(leftMargin + 70, topMargin + 128, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XCO + "", font2, XBrushes.Black, new XRect(leftMargin + 120, topMargin + 128, 10, 10), XStringFormats.TopLeft); gfx.DrawString("CREDITO", font, XBrushes.Black, new XRect(leftMargin + 70, topMargin + 139, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XCR + "", font2, XBrushes.Black, new XRect(leftMargin + 120, topMargin + 139, 10, 10), XStringFormats.TopLeft); gfx.DrawString("PLAZO EN DIAS", font, XBrushes.Black, new XRect(leftMargin + 150, topMargin + 139, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XPLAZODAY + " DIAS", font2, XBrushes.Black, new XRect(leftMargin + 210, topMargin + 139, 10, 10), XStringFormats.TopLeft); gfx.DrawString("VENTA TOTAL A PRECIO DE LISTA", font, XBrushes.Black, new XRect(leftMargin, topMargin + 160, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XIMPOBRUTO.ToString("##,###,##0.00") + "", font2, XBrushes.Black, new XRect(leftMargin + 120, topMargin + 160, 10, 10), XStringFormats.TopLeft); gfx.DrawString("TASA DE DESCUENTO", font, XBrushes.Black, new XRect(leftMargin, topMargin + 170, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XTASADESCTO + "%", font2, XBrushes.Black, new XRect(leftMargin + 120, topMargin + 170, 10, 10), XStringFormats.TopLeft); gfx.DrawString("VENTA TOTAL CON DESCUENTO", font, XBrushes.Black, new XRect(leftMargin, topMargin + 180, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XIMPONETO.ToString("##,###,##0.00") + "", font2, XBrushes.Black, new XRect(leftMargin + 120, topMargin + 180, 10, 10), XStringFormats.TopLeft); gfx.DrawString("PRECIOS DE LOS PRODUCTOS", font, XBrushes.Black, new XRect(leftMargin, topMargin + 190, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XNMONE + "", font2, XBrushes.Black, new XRect(leftMargin + 120, topMargin + 190, 10, 10), XStringFormats.TopLeft); gfx.DrawString("LOS PRECIOS INCLUYEN IGV", font, XBrushes.Black, new XRect(leftMargin, topMargin + 200, 10, 10), XStringFormats.TopLeft); gfx.DrawString(": " + XIGV + "", font2, XBrushes.Black, new XRect(leftMargin + 120, topMargin + 200, 10, 10), XStringFormats.TopLeft); //START RECTANGULO**************************************************************************************************************************************** pen = new XPen(XColors.Black, 2); gfx.DrawRoundedRectangle(pen, leftMargin + 300, topMargin + 80, 245, 100, 25, 25); // Pintamos los Datos de la Tabla de Session DataTable tabla01 = new DataTable(); tabla01 = (DataTable)Session["Tabla01"]; // AQUI DIBUJAMOS LAS CABECERAS DEL DETALLE font = new XFont("Abadi MT Condensed Light", 10, XFontStyle.Bold); gfx.DrawString(("DOC. DE PAGO").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 305, topMargin + 85, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("MONTO (SOLES)").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 396, topMargin + 85, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("FECHA VCTO.").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 487, topMargin + 85, 10, 10), XStringFormats.TopLeft); //Trasamos las Lineas de la Cabecera pen = new XPen(XColors.Black, 2); //pen.LineCap = XLineCap.Flat; gfx.DrawLine(pen, leftMargin + 300, topMargin + 97, leftMargin + 546, topMargin + 97); //gfx.DrawLine(pen, x1, y1, x2, y2); //CARGAMOS EL DETALLE int n = 15; foreach (DataRow fila in tabla01.Rows) { Double monto = Convert.ToDouble(fila["monto"].ToString()); font = new XFont("Abadi MT Condensed Light", 9, XFontStyle.Bold); gfx.DrawString((fila["num_interno"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 305, topMargin + 85 + n, 10, 10), XStringFormats.TopLeft); gfx.DrawString((monto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 396, topMargin + 85 + n, 10, 10), XStringFormats.TopLeft); gfx.DrawString(Equivalencias.Left((fila["fechven"].ToString()), 10), font, XBrushes.Black, new XRect(leftMargin + 487, topMargin + 85 + n, 10, 10), XStringFormats.TopLeft); n = n + 10; } // PIE DEL RECTANGULO gfx.DrawLine(pen, leftMargin + 300, topMargin + 165, leftMargin + 546, topMargin + 165); gfx.DrawString(("TOTAL CREDITO : " + XIMPONETO.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 310, topMargin + 170, 10, 10), XStringFormats.TopLeft); //END RECTANGULO ********************************************************************************************************************************************* pen = new XPen(XColors.Black, 3); //gfx2.DrawRoundedRectangle(pen, leftMargin + 0, topMargin + 220, 550, 40, 25, 25); // Pintamos los Datos de la Tabla de Session DataTable tabla02 = new DataTable(); tabla02 = (DataTable)Session["Tabla02"]; // AQUI DIBUJAMOS LAS CABECERAS DEL DETALLE font = new XFont("Abadi MT Condensed Light", 8.5, XFontStyle.Bold); gfx.DrawString(("CODIGO").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 5, topMargin + 228, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("MARCA").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 35, topMargin + 228, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("PRODUCTO").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 80, topMargin + 228, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("COLOR").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 250, topMargin + 228, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("TALLA").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 295, topMargin + 228, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("CANTIDAD").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 318, topMargin + 228, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("PRECIOS DE").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 350, topMargin + 225, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("LISTA").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 358, topMargin + 235, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("VENTAS A").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 400, topMargin + 225, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("PRECIOS DE LISTA").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 390, topMargin + 235, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("PRECIOS CON").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 450, topMargin + 225, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("DESCUENTO").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 451, topMargin + 235, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("VENTAS CON").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 500, topMargin + 225, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("DESCUENTO").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 501, topMargin + 235, 10, 10), XStringFormats.TopLeft); pen = new XPen(XColors.Black, 2); gfx.DrawLine(pen, 40, 265, 580, 265); //CARGAMOS EL DETALLE int n2 = 15; int nfilas = 40; foreach (DataRow fila in tabla02.Rows) { Double precbruto = Convert.ToDouble(fila["precbruto"].ToString()); Double impobruto = Convert.ToDouble(fila["impobruto"].ToString()); Double precneto = Convert.ToDouble(fila["precneto"].ToString()); Double imponeto = Convert.ToDouble(fila["imponeto"].ToString()); font = new XFont("Abadi MT Condensed Light", 7.5, XFontStyle.Bold); gfx.DrawString((fila["articidold"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 5, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((fila["marcaname"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 35, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((fila["articname"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 80, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((fila["colorname"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 250, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((fila["talla"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 299, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((fila["cantidad"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 318, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((precbruto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 358, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((impobruto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 400, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((precneto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 458, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx.DrawString((imponeto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 508, topMargin + 235 + n2, 10, 10), XStringFormats.TopLeft); n2 = n2 + 10; nfilas = nfilas + 12; } //nfilas = nfilas; gfx.DrawRoundedRectangle(pen, leftMargin + 0, topMargin + 220, 540, nfilas, 25, 25); //PIE DEL RECTANGULO gfx.DrawLine(pen, 40, topMargin + 220 + (nfilas - 12), 570, topMargin + 220 + (nfilas - 12)); font = new XFont("Abadi MT Condensed Light", 8, XFontStyle.Bold); gfx.DrawString(("TOTAL").PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 80, topMargin + 220 + (nfilas - 10), 10, 10), XStringFormats.TopLeft); gfx.DrawString((XIMPOBRUTO.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 400, topMargin + 220 + (nfilas - 10), 10, 10), XStringFormats.TopLeft); gfx.DrawString((XIMPONETO.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(leftMargin + 508, topMargin + 220 + (nfilas - 10), 10, 10), XStringFormats.TopLeft); #endregion //Se envia el PDF al browser MemoryStream stream = new MemoryStream(); document.Save(stream, false); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", stream.Length.ToString()); Response.BinaryWrite(stream.ToArray()); Response.Flush(); stream.Close(); Response.End(); } catch (Exception ex) { //Label1.Text = ex.Message; } }
private void Rpt_Proforma() { try { //Se crea el documento PDF PdfDocument document = new PdfDocument(); //Se configura los datos dela pagina document.Info.Title = "»» PROFORMA DE PEDIDOS ««"; document.Info.Author = "HVR"; //Se crea la pagina A4 PdfPage page = document.AddPage(); page.Orientation = PageOrientation.Portrait; Int16 intFila = 20; Int16 intColumna = 20; Int16 npag = 1; Int16 numFilas = 0; Int16 numColumna = 0; String imagenn = ""; XFont font2; //Se crea el objeto dibujo XGraphics gfx = XGraphics.FromPdfPage(page); XFont font = new XFont("Times New Roman", 10, XFontStyle.Bold); XTextFormatter tf = new XTextFormatter(gfx); //fuente de texto string fuente = "MS Mincho"; string fuente02 = "CCode39"; string XTEXTO = ""; //string fuente02 = "CCode39"; //Se crea e tipo de letra try { font = new XFont(fuente, 10, XFontStyle.Regular, new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always)); } catch (Exception exc) { } // XFont font = new XFont(fuente, 9, XFontStyle.Regular); XPen pen = new XPen(XColors.Navy, 1); string anio = Convert.ToString(DateTime.Now).Substring(6, 10); #region OBTENIENDO VALORES DE SESSION // DECLARANDO VARIBALES QUE RECIBIMOS DE SESSION string XEMPRESANAME = Session["ssEmpresaName"].ToString(); string XEMPRESARUC = Session["ssEmpresaRuc"].ToString(); string XGERENTEGENE = Session["ssGerenteGeneral"].ToString(); string XGERENTEDNI = Session["ssGerenteNrodni"].ToString(); string XPARTELECTRO = Session["ssPartElectro"].ToString(); Double XIMPOBRUTO = 0, XIMPONETO = 0; string XNUMDOC = "", XSERDOC = "", XTASADESCTO = "", XPLAZODAY = "", XNUMDOCS = "", XMEDIOPAGO = "", XNDIAS = "", XVENDORNAME = "", XCTACTENAME = "", XCLINMRUC = "", XDIREC = "", XREPLEGALNAME = "", XREPLEGALDNI = "", XFECHA = "", XCO = "", XCR = "", XNMONE = "", XIGV = ""; //VARIABLES RECIEN AGREGADAS EN LA BD string XREGPUBLICO = "", XPARTELECTRO2 = "", XESTCIVIL = ""; tb_cxc_pedidocabBL BL = new tb_cxc_pedidocabBL(); tb_cxc_pedidocab BE = new tb_cxc_pedidocab(); DataTable TablaProfor = new DataTable(); BE.tipdoc = Session["xtipdoc"].ToString(); BE.serdoc = Session["xserdoc"].ToString(); BE.numdoc = Session["xnumdoc"].ToString(); TablaProfor = BL.GetAll2(Session["ssEmpresaID"].ToString(), BE).Tables[0]; foreach (DataRow fila in TablaProfor.Rows) { XNUMDOC = fila["numdoc"].ToString(); XSERDOC = fila["serdoc"].ToString(); XTASADESCTO = fila["tasadescto"].ToString(); XPLAZODAY = fila["plazoday"].ToString(); XNUMDOCS = fila["numdocs"].ToString(); XMEDIOPAGO = fila["descripcion"].ToString(); XNDIAS = fila["ndias"].ToString(); XVENDORNAME = fila["vendorname"].ToString(); XCTACTENAME = fila["ctactename"].ToString(); XCLINMRUC = fila["nmruc"].ToString(); XDIREC = fila["direc"].ToString(); XREPLEGALNAME = fila["replegal_name"].ToString(); XREPLEGALDNI = fila["replegal_dni"].ToString(); XFECHA = fila["fecha"].ToString(); if (fila["condventaid"].ToString() == "02") XCR = "X"; else XCO = "X"; XNMONE = fila["precios"].ToString(); XIGV = fila["incluye_igv"].ToString(); XREGPUBLICO = fila["regpublico"].ToString(); XPARTELECTRO2 = fila["partelectro"].ToString(); XESTCIVIL = fila["estcivil"].ToString(); XIMPOBRUTO = Convert.ToDouble(fila["impobruto"].ToString()); XIMPONETO = Convert.ToDouble(fila["imponeto"].ToString()); } #endregion #region HOJA 01 font = new XFont("Arial", 11, XFontStyle.Underline); gfx.DrawString("CONTRATO DE COMPRA VENTA A CRÉDITO", font, XBrushes.Black, new XRect(intColumna + 170, intFila + 15, 10, 10), XStringFormats.TopLeft); font = new XFont("Arial", 9, XFontStyle.Bold); gfx.DrawString(("CONTRATO Nº " + XNUMDOC + "-VH/PIEERS-" + XSERDOC + ":").PadRight(25, ' '), font, XBrushes.Black, new XRect(intColumna + 30, intFila + 40, 10, 10), XStringFormats.TopLeft); // Cabecera Cambia Deacuerdo al NUMERO DE RUC if (Equivalencias.Left(XCLINMRUC, 1) == "2") { #region PERSONA JURIDICA XTEXTO ="Conste por el presente documento, que celebran de una parte " + XEMPRESANAME + " con "+ "RUC No." + XEMPRESARUC + ", con domicilio legal en Av. Abancay No. 186 Cercado de Lima, representado "+ "por su Gerente General, Srta. " + XGERENTEGENE + ", identificada "+ "con DNI No." + XGERENTEDNI + "según poder inscrito en la partida No." + XPARTELECTRO + " del Registro de Personas "+ "Jurídicas de Lima y Callao, a quien en adelante se le denominará LA EMPRESA, y de otra parte la Empresa "+ "" + XCTACTENAME + " con RUC Nº " + XCLINMRUC + " "+ "con domicilio en JR." + XDIREC + " "+ "debidamente representado por su Gerente General, el Sr(a)." + XREPLEGALNAME + ", según poder Nº" + XPARTELECTRO2 + " "+ "inscritos en los Registros Públicos de " + XREGPUBLICO + " identificado con DNI Nº." + XREPLEGALDNI + ", a quien en adelante "+ "se le denominara EL CLIENTE en los términos y condiciones siguientes: "; #endregion } else { #region PERSONA NATURAL String estado = ""; if (XESTCIVIL.ToString() == "1") { estado = "CASADO"; } else { estado = "SOLTERO"; } XTEXTO = "Conste por el presente documento, que celebran de una parte " + XEMPRESANAME + " con " + "RUC No." + XEMPRESARUC + ", con domicilio legal en Av. Abancay No. 186 Cercado de Lima, representado " + "por su Gerente General, Srta. " + XGERENTEGENE + ", identificada con DNI No." + XGERENTEDNI + " " + "según poder inscrito en la partida No." + XPARTELECTRO + " del Registro de Personas Jurídicas de Lima y Callao, " + "a quien en adelante se le denominará LA EMPRESA y de otra parte " + "el Señor(a)." + XCTACTENAME.Trim() + " con DNI Nº." + Equivalencias.Mid(XCLINMRUC, 3, 8) + ", estado civil " + estado + " " + "y domiciliado en " + XDIREC.Trim() + " a quien en adelante " + "se le denominara EL CLIENTE en los términos y condiciones siguientes: "; #endregion } XRect rect = new XRect(intColumna + 30, intFila + 60, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString(XTEXTO, font, XBrushes.Black, rect, XStringFormats.TopLeft); /* DECLARANDO EL TEXTO 02 */ gfx.DrawString(("PRIMERO.- LA EMPRESA, es una Institución que se dedica a la confección y venta de prendas de vestir.").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 30, intFila + 170, 10, 10), XStringFormats.TopLeft); rect = new XRect(50, 210, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("SEGUNDO.- Por el presente contrato, LA EMPRESA vende a EL CLIENTE los productos de su fabricación que " + "se detallan en el anexo 01 que forma parte del presente contrato.",font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(50, 240, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("TERCERO.- LA EMPRESA y EL CLIENTE de común acuerdo establecen que la presente venta es al crédito "+ "con las siguientes condiciones comerciales: ", font, XBrushes.Black, rect, XStringFormats.TopLeft); gfx.DrawString("1) El valor total de la venta, con el " + XTASADESCTO + "% de descuento es de S/. " + XIMPONETO.ToString("#,###,#00.00") + "(nuevos soles), incluido IGV.", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 240, 10, 10), XStringFormats.TopLeft); gfx.DrawString("2) El plazo del crédito es de " + XPLAZODAY + " días ", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 250, 10, 10), XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 260, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("3) EL CLIENTE, pagará el crédito total con " + XNUMDOCS + " " + XMEDIOPAGO + " por los montos y fechas " + "de vencimiento que se indican a continuación:", font, XBrushes.Black, rect, XStringFormats.TopLeft); //START RECTANGULO**************************************************************************************************************************************** pen = new XPen(XColors.LightBlue, 5); gfx.DrawRoundedRectangle(pen, intColumna + 70, intFila + 300, 245, 100, 25, 25); // Pintamos los Datos de la Tabla de Session DataTable tabla01 = new DataTable(); tabla01 = (DataTable)Session["Tabla01"]; // AQUI DIBUJAMOS LAS CABECERAS DEL DETALLE font = new XFont("Abadi MT Condensed Light", 10, XFontStyle.Bold); gfx.DrawString(("DOC. DE PAGO").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 75, intFila + 305, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("MONTO (SOLES)").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 166, intFila + 305, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("FECHA VCTO.").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 250, intFila + 305, 10, 10), XStringFormats.TopLeft); //Trasamos las Lineas de la Cabecera pen = new XPen(XColors.LightBlue, 2); //pen.LineCap = XLineCap.Flat; gfx.DrawLine(pen, 92, 335, 335, 335); //gfx.DrawLine(XPens.Black, 92, 335, 335, 335); //CARGAMOS EL DETALLE int n = 15; foreach (DataRow fila in tabla01.Rows) { Double monto = Convert.ToDouble(fila["monto"].ToString()); font = new XFont("Abadi MT Condensed Light", 9, XFontStyle.Bold); gfx.DrawString((fila["num_interno"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 75, intFila + 305 + n, 10, 10), XStringFormats.TopLeft); gfx.DrawString((monto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 170, intFila + 305 + n, 10, 10), XStringFormats.TopLeft); gfx.DrawString(Equivalencias.Left((fila["fechven"].ToString()), 10), font, XBrushes.Black, new XRect(intColumna + 250, intFila + 305 + n, 10, 10), XStringFormats.TopLeft); n = n + 10; } // PIE DEL RECTANGULO gfx.DrawLine(pen, 92, 405, 335, 405); gfx.DrawString(("TOTAL CREDITO : " + XIMPONETO.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 72, intFila + 385, 10, 10), XStringFormats.TopLeft); //END RECTANGULO ********************************************************************************************************************************************* font = new XFont("Arial", 9, XFontStyle.Bold); rect = new XRect(intColumna + 30, intFila + 410, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("4) El pago de las letras se efectuara en el Banco de Crédito del Perú, para este efecto EL CLIENTE " + "deberá mencionar el 'número único' de la respectiva letra de cambio.", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 430, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("5) LA EMPRESA, efectuará el despacho de los productos a los " + XNDIAS + " días de haberse suscrito el presente " + "contrato, en la agencia de transporte que indique EL CLIENTE.", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 450, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("6) EL CLIENTE, asume los costos de transporte de los productos adquiridos siendo de su entera responsabilidad " + "el traslado de los mismos desde la agencia de transporte hasta el lugar o local comercial de destino.", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 480, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("CUARTO.- Si EL CLIENTE incumpliera con el pago de sus letras, LA EMPRESA podrá ejecutar dichas letras " + "por la vía legal.", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 510, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("QUINTO.- Si EL CLIENTE pagara el crédito total antes del plazo acordado, se actualizará las tasas de " + "descuento al plazo que corresponda mediante notas de crédito.", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 540, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("SEXTO.- Si EL CLIENTE incumpliera con el pago total de los créditos concedidos en los plazos acordados, " + "se actualizará las tasas de descuento a los plazos que corresponda mediante notas de débito.", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 570, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("SÉPTIMO.- Si EL CLIENTE, por motivos injustificados, demore con realizar el pago total o lo que resta " + "de su deuda por más de 90 días perderá el 50 % del descuento concedido.", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(intColumna + 30, intFila + 600, 500, 100); gfx.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString("OCTAVO.- Las partes acuerdan que para todo lo relacionado con el cumplimiento de las cláusulas del " + "presente contrato de compra venta, se someten a la jurisdicción de los jueces y tribunales de Lima, "+ "o mediante arbitraje, señalando sus domicilios en la parte introductoria del presente contrato.", font, XBrushes.Black, rect, XStringFormats.TopLeft); gfx.DrawString(("" + XFECHA + "").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 310, intFila + 660, 10, 10), XStringFormats.TopLeft); // VALIDAMOS PRIMERO QUE TIPO DE PERSONA ES NATURAL O JURIDICA // 2 = JURIDICA // 1 = NATURAL if (Equivalencias.Left(XCLINMRUC, 1) == "2") { // VALIDAMOS EL ESTADO CIVIL DEL CLIENTE // 1 = CASADO // 2 = SOLTERO if (XESTCIVIL.ToString() == "1") { gfx.DrawString(("LA EMPRESA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 100, intFila + 700, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("EL CLIENTE").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 310, intFila + 700, 10, 10), XStringFormats.TopLeft); } else { gfx.DrawString(("LA EMPRESA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 100, intFila + 700, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("EL CLIENTE").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 310, intFila + 700, 10, 10), XStringFormats.TopLeft); } } if (Equivalencias.Left(XCLINMRUC, 1) == "1") { if (XESTCIVIL.ToString() == "1") { gfx.DrawString(("LA EMPRESA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 100, intFila + 700, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("EL CLIENTE").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 210, intFila + 700, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("EL CONYUGUE").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 320, intFila + 700, 10, 10), XStringFormats.TopLeft); } else { gfx.DrawString(("LA EMPRESA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 100, intFila + 700, 10, 10), XStringFormats.TopLeft); gfx.DrawString(("EL CLIENTE").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 310, intFila + 700, 10, 10), XStringFormats.TopLeft); } } #endregion //SE CREA LA PAGINA A4 NUMERO 2 PdfPage page2 = document.AddPage(); page2.Orientation = PageOrientation.Portrait; XGraphics gfx2 = XGraphics.FromPdfPage(page2); tf = new XTextFormatter(gfx2); font = new XFont("Arial", 9.5, XFontStyle.Bold); gfx2.DrawString("ANEXO 01", font, XBrushes.Black, new XRect(intColumna + 260, intFila + 15, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("DETALLE DE PRODUCTOS VENDIDOS", font, XBrushes.Black, new XRect(intColumna + 200, intFila + 25, 10, 10), XStringFormats.TopLeft); font = new XFont("Arial", 10, XFontStyle.Bold); font2 = new XFont("Arial", 9); gfx2.DrawString("VENDEDOR", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 50, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XVENDORNAME + "", font2, XBrushes.Black, new XRect(intColumna + 90, intFila + 50, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("CLIENTE", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 60, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XCTACTENAME + "", font2, XBrushes.Black, new XRect(intColumna + 90, intFila + 60, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("RUC", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 70, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XCLINMRUC + "", font2, XBrushes.Black, new XRect(intColumna + 90, intFila + 70, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("DIRECC", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 80, 10, 10), XStringFormats.TopLeft); //gfx2.DrawString(": " + XDIREC + "", font2, XBrushes.Black, new XRect(intColumna + 90, intFila + 90, 10, 10), XStringFormats.TopLeft); rect = new XRect(intColumna + 90, intFila + 80, 430, 100); gfx2.DrawRectangle(XBrushes.White, rect); tf.Alignment = XParagraphAlignment.Justify; tf.DrawString(": " + XDIREC + "", font2, XBrushes.Black, rect, XStringFormats.TopLeft); gfx2.DrawString("NUM-CONTRATO", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 100, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XNUMDOC + "", font2, XBrushes.Black, new XRect(intColumna + 120, intFila + 100, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("COND-VENTA : ", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 110, 10, 10), XStringFormats.TopLeft); // DIBUJAR UN RECTANGULO pen = new XPen(XColors.LightBlue, 2); gfx2.DrawRoundedRectangle(pen, intColumna + 57, intFila + 125, 90, 30, 25, 25); gfx2.DrawString("CONTADO", font, XBrushes.Black, new XRect(intColumna + 60, intFila + 128, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XCO + "", font2, XBrushes.Black, new XRect(intColumna + 120, intFila + 128, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("CREDITO", font, XBrushes.Black, new XRect(intColumna + 60, intFila + 139, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XCR + "", font2, XBrushes.Black, new XRect(intColumna + 120, intFila + 139, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("PLAZO EN DIAS", font, XBrushes.Black, new XRect(intColumna + 150, intFila + 139, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XPLAZODAY + " DIAS", font2, XBrushes.Black, new XRect(intColumna + 240, intFila + 139, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("VENTA TOTAL A PRECIO DE LISTA", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 160, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XIMPOBRUTO.ToString("##,###,##0.00") + "", font2, XBrushes.Black, new XRect(intColumna + 240, intFila + 160, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("TASA DE DESCUENTO", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 170, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XTASADESCTO + "%", font2, XBrushes.Black, new XRect(intColumna + 240, intFila + 170, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("VENTA TOTAL CON DESCUENTO", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 180, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XIMPONETO.ToString("##,###,##0.00") + "", font2, XBrushes.Black, new XRect(intColumna + 240, intFila + 180, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("PRECIOS DE LOS PRODUCTOS", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 190, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XNMONE + "", font2, XBrushes.Black, new XRect(intColumna + 240, intFila + 190, 10, 10), XStringFormats.TopLeft); gfx2.DrawString("LOS PRECIOS INCLUYEN IGV", font, XBrushes.Black, new XRect(intColumna + 30, intFila + 200, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(": " + XIGV + "", font2, XBrushes.Black, new XRect(intColumna + 240, intFila + 200, 10, 10), XStringFormats.TopLeft); //START RECTANGULO II **************************************************************************************************************************************** pen = new XPen(XColors.LightBlue, 3); //gfx2.DrawRoundedRectangle(pen, intColumna + 0, intFila + 220, 550, 40, 25, 25); // Pintamos los Datos de la Tabla de Session DataTable tabla02 = new DataTable(); tabla02 = (DataTable)Session["Tabla02"]; // AQUI DIBUJAMOS LAS CABECERAS DEL DETALLE font = new XFont("Abadi MT Condensed Light", 8.5, XFontStyle.Bold); gfx2.DrawString(("CODIGO").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 5, intFila + 228, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("MARCA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 35, intFila + 228, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("PRODUCTO").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 80, intFila + 228, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("COLOR").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 250, intFila + 228, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("TALLA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 295, intFila + 228, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("CANTIDAD").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 318, intFila + 228, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("PRECIOS DE").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 350, intFila + 225, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("LISTA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 358, intFila + 235, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("VENTAS A").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 400, intFila + 225, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("PRECIOS DE LISTA").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 390, intFila + 235, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("PRECIOS CON").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 450, intFila + 225, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("DESCUENTO").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 451, intFila + 235, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("VENTAS CON").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 500, intFila + 225, 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("DESCUENTO").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 501, intFila + 235, 10, 10), XStringFormats.TopLeft); pen = new XPen(XColors.LightBlue, 2); gfx2.DrawLine(pen, 20, 265, 570, 265); //CARGAMOS EL DETALLE int n2 = 15; int nfilas = 40; foreach (DataRow fila in tabla02.Rows) { Double precbruto = Convert.ToDouble(fila["precbruto"].ToString()); Double impobruto = Convert.ToDouble(fila["impobruto"].ToString()); Double precneto = Convert.ToDouble(fila["precneto"].ToString()); Double imponeto = Convert.ToDouble(fila["imponeto"].ToString()); font = new XFont("Abadi MT Condensed Light", 7.5, XFontStyle.Bold); gfx2.DrawString((fila["articidold"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 5, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((fila["marcaname"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 35, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((fila["articname"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 80, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((fila["colorname"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 250, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((fila["talla"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 299, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((fila["cantidad"].ToString()).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 318, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((precbruto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 358, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((impobruto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 400, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((precneto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 458, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); gfx2.DrawString((imponeto.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 508, intFila + 235 + n2, 10, 10), XStringFormats.TopLeft); n2 = n2 + 10; nfilas = nfilas + 12; } //nfilas = nfilas; gfx2.DrawRoundedRectangle(pen, intColumna + 0, intFila + 220, 550, nfilas, 25, 25); //PIE DEL RECTANGULO gfx2.DrawLine(pen, 20, intFila + 220 + (nfilas - 12), 570, intFila + 220 + (nfilas - 12)); font = new XFont("Abadi MT Condensed Light", 8, XFontStyle.Bold); gfx2.DrawString(("TOTAL").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 80, intFila + 220 + (nfilas - 10), 10, 10), XStringFormats.TopLeft); gfx2.DrawString((XIMPOBRUTO.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 400, intFila + 220 + (nfilas - 10), 10, 10), XStringFormats.TopLeft); gfx2.DrawString((XIMPONETO.ToString("##,###,##0.00")).PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 508, intFila + 220 + (nfilas - 10), 10, 10), XStringFormats.TopLeft); //END RECTANGULO ********************************************************************************************************************************************* gfx2.DrawString(("FIRMA GERENCIA GENERAL").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 80, intFila + 220 + (nfilas + 30), 10, 10), XStringFormats.TopLeft); gfx2.DrawString(("FIRMA CLIENTE").PadRight(19, ' '), font, XBrushes.Black, new XRect(intColumna + 295, intFila + 220 + (nfilas + 30), 10, 10), XStringFormats.TopLeft); //Se envia el PDF al browser MemoryStream stream = new MemoryStream(); document.Save(stream, false); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", stream.Length.ToString()); Response.BinaryWrite(stream.ToArray()); Response.Flush(); stream.Close(); Response.End(); } catch (Exception ex) { Label1.Text = ex.Message; } }
private void Rpt_EvalCrediticia() { try { //Se crea el documento PDF PdfDocument document = new PdfDocument(); //Se configura los datos dela pagina document.Info.Title = "»» EVALUACIÓN CREDITICIA ««"; document.Info.Author = "HVR"; //Se crea la pagina A4 PdfPage page = document.AddPage(); page.Orientation = PageOrientation.Portrait; //Se crea el objeto dibujo XGraphics gfx = XGraphics.FromPdfPage(page); XPen pen = new XPen(XColors.Navy, 1); string anio = Convert.ToString(DateTime.Now).Substring(6, 10); XRect rect; XFont fontB18 = new XFont("Times", 20, XFontStyle.Bold); XFont fontB12 = new XFont("Times", 12, XFontStyle.Bold); XFont fontB9 = new XFont("Times", 9, XFontStyle.Bold); XFont font9 = new XFont("Times", 9); #region OBTENIENDO VALORES DE SESSION // DECLARANDO VARIBALES QUE RECIBIMOS DE SESSION string XEMPRESANAME = Session["ssEmpresaName"].ToString(); string XEMPRESARUC = Session["ssEmpresaRuc"].ToString(); string XGERENTEGENE = Session["ssGerenteGeneral"].ToString(); string XGERENTEDNI = Session["ssGerenteNrodni"].ToString(); string XPARTELECTRO = Session["ssPartElectro"].ToString(); string XUSUAR = Session["ssUsuar"].ToString(); int XPUNTAJE = 0; Boolean XESJURIDICA = false, XCOPIACONST = false, XCOPIARUC = false, XCOPIADNI = false, XLICFUNC = false, XTITLOCAL = false, XCONTLOCAL = false, XRECIBO = false, XTIENLETR = false, XTIENMORO = false, XMOROSO = false, XBIENMUEB = false, XBIENINMUEB = false; string XNUMDOC = "", XSERDOC = "", XCTACTENAME = "", XCLINMRUC = "", XFECHA = "", XREFCOMER = "", XREFBANCA = "",XEVALCXCOB ="",XOBSCXCOB="",XOBSGEREN="",XAPROBGERE=""; tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL(); tb_cxc_evalcred BE = new tb_cxc_evalcred(); DataTable TablaEval = new DataTable(); BE.tipdoc = Session["xtipdoc"].ToString(); BE.serdoc = Session["xserdoc"].ToString(); BE.numdoc = Session["xnumdoc"].ToString(); TablaEval = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0]; foreach (DataRow fila in TablaEval.Rows) { XNUMDOC = fila["numdoc"].ToString(); XSERDOC = fila["serdoc"].ToString(); XCTACTENAME = fila["ctactename"].ToString(); XCLINMRUC = fila["nmruc"].ToString(); XFECHA = fila["fechdoc"].ToString(); XESJURIDICA = Convert.ToBoolean(fila["es_persjuridica"].ToString()); XCOPIACONST = Convert.ToBoolean(fila["copia_constitucionempresa"].ToString()); XCOPIARUC = Convert.ToBoolean(fila["copia_ruc"].ToString()); XCOPIADNI = Convert.ToBoolean(fila["copia_dni"].ToString()); XLICFUNC = Convert.ToBoolean(fila["lic_func"].ToString()); XTITLOCAL = Convert.ToBoolean(fila["titulo_localcom"].ToString()); XCONTLOCAL = Convert.ToBoolean(fila["contra_localcom"].ToString()); XRECIBO = Convert.ToBoolean(fila["recibo_agualuz"].ToString()); XTIENLETR = Convert.ToBoolean(fila["tiene_letraprotestada"].ToString()); XTIENMORO = Convert.ToBoolean(fila["tiene_morosidad"].ToString()); XMOROSO = Convert.ToBoolean(fila["moroso_infocorp"].ToString()); XREFCOMER = fila["refe_comerc"].ToString(); XREFBANCA = fila["refe_banca"].ToString(); XBIENMUEB = Convert.ToBoolean(fila["bienes_bienmueble"].ToString()); XBIENINMUEB = Convert.ToBoolean(fila["bienes_inmuebles"].ToString()); XPUNTAJE = Convert.ToInt32(fila["puntaje"].ToString()); XEVALCXCOB = fila["eval_cxcob"].ToString(); XOBSCXCOB = fila["obs_cxcob"].ToString(); XAPROBGERE = fila["aprob_gerencial"].ToString(); XOBSGEREN = fila["obs_gerencial"].ToString(); } #endregion Double XIMPOBRUTO = 0, XIMPONETO = 0; String XVENDORNAME = ""; //VARIABLES RECIEN AGREGADAS EN LA BD tb_cxc_pedidocabBL BL2 = new tb_cxc_pedidocabBL(); tb_cxc_pedidocab BE2 = new tb_cxc_pedidocab(); DataTable TablaProfor = new DataTable(); BE2.tipdoc = Session["xtipdoc"].ToString(); BE2.serdoc = Session["xserdoc"].ToString(); BE2.numdoc = Session["xnumdoc"].ToString(); TablaProfor = BL2.GetAll2(Session["ssEmpresaID"].ToString(), BE2).Tables[0]; if (TablaProfor.Rows.Count > 0) { XVENDORNAME = TablaProfor.Rows[0]["vendorname"].ToString(); } //define margins double leftMargin = 40.0; double rightMargin = 570.0; double topMargin = 20.0; double lineTop = 0d; double lineFooter = 780d; double rowStep = 12d; double newRow = topMargin + rowStep; double beginRow = newRow; double currentRow = beginRow; double currentRowCol2 = 0; double firstCustomerRow = 100d; double txtShift = 8d; string hcString = string.Empty; //---added 6-26-13 string sim1 = "["; string sim2 = "]"; string space = " "; // TITULO gfx.DrawString("EVALUACION CREDITICIA", fontB18, XBrushes.Black, leftMargin + 20, topMargin + 40); pen = new XPen(XColors.Black, 2); gfx.DrawRoundedRectangle(pen, leftMargin + 300, topMargin + 15, 240, 50, 15, 15); // CUADRO gfx.DrawString("PEDIDO", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 30); gfx.DrawString(": PD-"+XNUMDOC, font9, XBrushes.Black, leftMargin + 370, topMargin + 30); gfx.DrawString("FECHA", fontB9, XBrushes.Black, leftMargin + 440, topMargin + 30); gfx.DrawString(": " + Equivalencias.Left(XFECHA, 10), font9, XBrushes.Black, leftMargin + 480, topMargin + 30); gfx.DrawString("CLIENTE", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 40); gfx.DrawString(": "+Equivalencias.Left(XCTACTENAME,30) , font9, XBrushes.Black, leftMargin + 370, topMargin + 40); gfx.DrawString("RUC", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 50); gfx.DrawString(": "+XCLINMRUC, font9, XBrushes.Black, leftMargin + 370, topMargin + 50); gfx.DrawString("VENDEDOR", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 60); gfx.DrawString(": " + XVENDORNAME, font9, XBrushes.Black, leftMargin + 370, topMargin + 60); // CONTENIDO gfx.DrawString("I.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 80); gfx.DrawString("DOCUMENTACION PARA LA EVALUACION CREDITICIA :", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 80); gfx.DrawString("1.", font9, XBrushes.Black, leftMargin + 50, topMargin + 95); gfx.DrawString("CONDICION JURIDICA DEL CLIENTE :", font9, XBrushes.Black, leftMargin + 70, topMargin + 95); if (XESJURIDICA) { gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 108); gfx.DrawString("PERSONA NATURAL", font9, XBrushes.Black, leftMargin + 90, topMargin + 108); gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 118); gfx.DrawString("PERSONA JURIDICA", font9, XBrushes.Black, leftMargin + 90, topMargin + 118); } else { gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 108); gfx.DrawString("PERSONA NATURAL", font9, XBrushes.Black, leftMargin + 90, topMargin + 108); gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 118); gfx.DrawString("PERSONA JURIDICA", font9, XBrushes.Black, leftMargin + 90, topMargin + 118); } gfx.DrawString("2.", font9, XBrushes.Black, leftMargin + 50, topMargin + 133); gfx.DrawString("DOCUMENTOS PRESENTADOS POR EL CLIENTE :", font9, XBrushes.Black, leftMargin + 70, topMargin + 133); // COLUMNA 1 if(XCOPIACONST) gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 146); else gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 146); gfx.DrawString("CONSTITUCION DE LA EMPRESA", font9, XBrushes.Black, leftMargin + 90, topMargin + 146); if(XCOPIARUC) gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 156); else gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 156); gfx.DrawString("RUC", font9, XBrushes.Black, leftMargin + 90, topMargin + 156); if(XCOPIADNI) gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 166); else gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 166); gfx.DrawString("DNI", font9, XBrushes.Black, leftMargin + 90, topMargin + 166); // COLUMNA 2 if(XLICFUNC) gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 146); else gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 146); gfx.DrawString("LIC. DE FUNCIONAMIENTO", font9, XBrushes.Black, leftMargin + 320, topMargin + 146); if(XTITLOCAL) gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 156); else gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 156); gfx.DrawString("TITULO DE PROPIEDAD", font9, XBrushes.Black, leftMargin + 320, topMargin + 156); if(XCONTLOCAL) gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 166); else gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 166); gfx.DrawString("CONTRATO DE LOCAL", font9, XBrushes.Black, leftMargin + 320, topMargin + 166); if(XRECIBO) gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 176); else gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 176); gfx.DrawString("RECIBO AGUA O LUZ", font9, XBrushes.Black, leftMargin + 320, topMargin + 176); gfx.DrawString("II.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 200); gfx.DrawString("FACTORES DE EVALUACION CREDITICIA:", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 200); // COLUMNA 1 gfx.DrawString("3.", font9, XBrushes.Black, leftMargin + 50, topMargin + 215); gfx.DrawString("COMPORTAMIENTO DE PAGO", font9, XBrushes.Black, leftMargin + 70, topMargin + 215); gfx.DrawString("3.1", font9, XBrushes.Black, leftMargin + 70, topMargin + 228); gfx.DrawString("PROTESTOS DE LETRA", font9, XBrushes.Black, leftMargin + 90, topMargin + 228); string x1 = space, x2 = space; if (XTIENLETR) x1 = "X"; else x2 = "X"; gfx.DrawString(sim1 + x1 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 241); gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 241); gfx.DrawString(sim1 + x2 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 251); gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 251); gfx.DrawString("3.2", font9, XBrushes.Black, leftMargin + 70, topMargin + 264); gfx.DrawString("INCUMPLIMIENTO DE PAGO", font9, XBrushes.Black, leftMargin + 90, topMargin + 264); string x3 = space, x4 = space; if (XTIENMORO) x3 = "X"; else x4 = "X"; gfx.DrawString(sim1 + x3 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 277); gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 277); gfx.DrawString(sim1 + x4 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 287); gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 287); gfx.DrawString("4.", font9, XBrushes.Black, leftMargin + 50, topMargin + 310); gfx.DrawString("ANTECEDENTES INFOCORP", font9, XBrushes.Black, leftMargin + 70, topMargin + 310); string x5 = space, x6 = space; if (XMOROSO) x5 = "X"; else x6 = "X"; gfx.DrawString(sim1 + x5 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 323); gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 323); gfx.DrawString(sim1 + x6 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 333); gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 333); // COLUMNA 2 gfx.DrawString("5.", font9, XBrushes.Black, leftMargin + 300, topMargin + 215); gfx.DrawString("REFERENCIAS COMERCIALES", font9, XBrushes.Black, leftMargin + 320, topMargin + 215); string xva1 = space, xva2 = space, xva3 = space; if (XREFCOMER.Length > 0) { if (XREFCOMER.ToString() == "B") xva1 = "X"; else if (XREFCOMER.ToString() == "R") xva2 = "X"; else if (XREFCOMER.ToString() == "M") xva3 = "X"; } gfx.DrawString(sim1 + xva1 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 228); gfx.DrawString("BUENA", font9, XBrushes.Black, leftMargin + 340, topMargin + 228); gfx.DrawString(sim1 + xva2 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 238); gfx.DrawString("REGULAR", font9, XBrushes.Black, leftMargin + 340, topMargin + 238); gfx.DrawString(sim1 + xva3 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 248); gfx.DrawString("MALA", font9, XBrushes.Black, leftMargin + 340, topMargin + 248); gfx.DrawString("6.", font9, XBrushes.Black, leftMargin + 300, topMargin + 271); gfx.DrawString("REFERENCIAS BANCARIAS", font9, XBrushes.Black, leftMargin + 320, topMargin + 271); string xva4 = space, xva5 = space, xva6 = space; if (XREFBANCA.Length > 0) { if (XREFBANCA.ToString() == "B") xva4 = "X"; else if (XREFBANCA.ToString() == "R") xva5 = "X"; else if (XREFBANCA.ToString() == "M") xva6 = "X"; } gfx.DrawString(sim1 + xva4 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 284); gfx.DrawString("BUENA", font9, XBrushes.Black, leftMargin + 340, topMargin + 284); gfx.DrawString(sim1 + xva5 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 294); gfx.DrawString("REGULAR", font9, XBrushes.Black, leftMargin + 340, topMargin + 294); gfx.DrawString(sim1 + xva6 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 304); gfx.DrawString("MALA", font9, XBrushes.Black, leftMargin + 340, topMargin + 304); gfx.DrawString("7.", font9, XBrushes.Black, leftMargin + 300, topMargin + 327); gfx.DrawString("EVALUACION PATRIMONIAL", font9, XBrushes.Black, leftMargin + 320, topMargin + 327); gfx.DrawString("7.1", font9, XBrushes.Black, leftMargin + 320, topMargin + 340); gfx.DrawString("BIENES MUEBLES", font9, XBrushes.Black, leftMargin + 340, topMargin + 340); string x7 = space, x8 = space; if (XBIENMUEB) x7 = "X"; else x8 = "X"; gfx.DrawString(sim1 + x7 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 351); gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 351); gfx.DrawString(sim1 + x8 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 361); gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 361); gfx.DrawString("7.2", font9, XBrushes.Black, leftMargin + 320, topMargin + 374); gfx.DrawString("BIENES INMUEBLES", font9, XBrushes.Black, leftMargin + 340, topMargin + 374); string x9 = space, x10 = space; if (XBIENINMUEB) x9 = "X"; else x10 = "X"; gfx.DrawString(sim1 + x9 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 387); gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 387); gfx.DrawString(sim1 + x10 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 397); gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 397); //---------- gfx.DrawString("III.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 420); gfx.DrawString("OPINION AREA DE VENTAS HORIZONTALES", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 420); string xcli1 = space, xcli2 = space, xcli3 = space; if (XEVALCXCOB.Length > 0) { if (XEVALCXCOB.ToString() == "CA") xcli1 = "X"; else if (XEVALCXCOB.ToString() == "CN") xcli2 = "X"; else if (XEVALCXCOB.ToString() == "CD") xcli3 = "X"; } gfx.DrawString(sim1 + xcli1 + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 435); gfx.DrawString("CLIENTE ACEPTABLE", font9, XBrushes.Black, leftMargin + 90, topMargin + 435); gfx.DrawString(sim1 + xcli2 + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 445); gfx.DrawString("CLIENTE NO ACEPTABLE", font9, XBrushes.Black, leftMargin + 90, topMargin + 445); gfx.DrawString(sim1 + xcli3 + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 455); gfx.DrawString("CLIENTE DUDOSO", font9, XBrushes.Black, leftMargin + 90, topMargin + 455); gfx.DrawString("OTROS COMENTARIOS:", font9, XBrushes.Black, leftMargin + 50, topMargin + 475); gfx.DrawString("» "+XOBSCXCOB, font9, XBrushes.Black, leftMargin + 80, topMargin + 490); gfx.DrawString("IV.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 520); gfx.DrawString("APROBACIÓN GERENCIA GENERAL", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 520); string x11 = space, x12 = space; if (XAPROBGERE == "32") x11 = "X"; else if (XAPROBGERE == "39") x12 = "X"; gfx.DrawString(sim1 + x11 + sim2, font9, XBrushes.Black, leftMargin + 200, topMargin + 533); gfx.DrawString("APROBADO", font9, XBrushes.Black, leftMargin + 220, topMargin + 533); gfx.DrawString(sim1 + x12 + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 533); gfx.DrawString("NO APROBADO", font9, XBrushes.Black, leftMargin + 320, topMargin + 533); gfx.DrawString("OBSERVACIONES:", font9, XBrushes.Black, leftMargin + 50, topMargin + 553); gfx.DrawString("» " + XOBSGEREN, font9, XBrushes.Black, leftMargin + 80, topMargin + 568); string texto = "NOTA: A ESTE FORMATO SE DEBERA ANEXAR LA DOCUMENTACIÓN CORRESPONDIENTE"; gfx.DrawString(texto, fontB9, XBrushes.Black, leftMargin + 50, topMargin + 598); //SE ENVIA EL PDF AL BROWSER MemoryStream stream = new MemoryStream(); document.Save(stream, false); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", stream.Length.ToString()); Response.BinaryWrite(stream.ToArray()); Response.Flush(); stream.Close(); Response.End(); } catch (Exception ex) { Label1.Text = ex.Message; } }