本文整理汇总了C#中DAL.QueryDT方法的典型用法代码示例。如果您正苦于以下问题:C# DAL.QueryDT方法的具体用法?C# DAL.QueryDT怎么用?C# DAL.QueryDT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAL
的用法示例。
在下文中一共展示了DAL.QueryDT方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: formatoABCDIJKLM
//.........这里部分代码省略.........
encabezado.AddCell(cel);
par = new Paragraph();
par.SetLeading(7f, 1f);
par.Add(new Chunk("División: ", f5B));
par.Add(new Chunk(dtEncabezado.Rows[0]["division"].ToString(), f5));//CE20
cel = new Cell(par);
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_CENTER;
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = (float).5;
cel.BorderWidthBottom = 0;
cel.BorderColor = gris;
cel.Colspan = 3;
encabezado.AddCell(cel);
#endregion
#region "Construimos Tablas de Partidas"
#region "Añadimos Detalle de Conceptos"
// Creamos la tabla para insertar los conceptos de detalle de la factura
StringBuilder sbOpcionalDetalle = new StringBuilder();
sbOpcionalDetalle.
Append("SELECT ROW_NUMBER() OVER (ORDER BY idCfdi ASC) AS numero, ").
Append("campo1 AS codigoProducto, campo18 AS codigoBarras, ").
Append("campo3 AS lote, campo5 AS fechaLote, campo4 AS cantidadLote ").
Append("FROM opcionalDetalle ").
Append("WHERE idCfdi = @0 ");
DataTable dtOpcionalDetalle = dal.QueryDT("DS_FE", sbOpcionalDetalle.ToString(), "F:I:" + idCfdi, hc);
// Obtenemos los conceptos guardados en el Xml
int numConceptosXml = electronicDocument.Data.Conceptos.Count;
// Debido a que no siempre hacen match el número de conceptos de xml con los de opcionalDetalle armamos un Hashtable
// Armamos la tabla que contendra los conceptops finales a imprimir en el Pdf
DataTable dtConceptosFinal = new DataTable();
dtConceptosFinal.Columns.Add("numero", typeof(int));
dtConceptosFinal.Columns.Add("codigoBarras", typeof(string));
dtConceptosFinal.Columns.Add("codigoProducto", typeof(string));
dtConceptosFinal.Columns.Add("lote", typeof(string));
dtConceptosFinal.Columns.Add("fechaLote", typeof(string));
dtConceptosFinal.Columns.Add("cantidadLote", typeof(string));
dtConceptosFinal.Columns.Add("descripcion", typeof(string));
dtConceptosFinal.Columns.Add("cantidad", typeof(double));
dtConceptosFinal.Columns.Add("unidadMedida", typeof(string));
dtConceptosFinal.Columns.Add("precioUnitario", typeof(double));
dtConceptosFinal.Columns.Add("importe", typeof(double));
int contConceptos = 1;
foreach (DataRow rowConceptos in dtOpcionalDetalle.Rows)
{
for (int i = contConceptos; i <= numConceptosXml; i++)
{
object[] arrayConceptos = new object[11];
if (Convert.ToInt32(rowConceptos["numero"]) == i)
{
arrayConceptos[0] = Convert.ToInt32(rowConceptos["numero"]);
arrayConceptos[1] = rowConceptos["codigoBarras"].ToString();
示例2: generarPdf
public static string generarPdf(Hashtable htFacturaxion, HttpContext hc)
{
string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
FileStream fs = new FileStream(pathPdf, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
try
{
DAL dal = new DAL();
_ci.NumberFormat.CurrencyDecimalDigits = 2;
ElectronicDocument electronicDocument = (ElectronicDocument)htFacturaxion["electronicDocument"];
Data objTimbre = (Data)htFacturaxion["objTimbre"];
timbrar = Convert.ToBoolean(htFacturaxion["timbrar"]);
pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
Int64 idCfdi = Convert.ToInt64(htFacturaxion["idCfdi"]);
#region "Obtenemos los datos del CFDI y Campos Opcionales"
StringBuilder sbOpcionalEncabezado = new StringBuilder();
DataTable dtOpcEnc = new DataTable();
StringBuilder sbOpcionalDetalle = new StringBuilder();
DataTable dtOpcDet = new DataTable();
StringBuilder sbDataEmisor = new StringBuilder();
DataTable dtDataEmisor = new DataTable();
sbOpcionalEncabezado.
Append("SELECT ").
Append("campo3 AS ordenCompra, ").
Append("campo7 AS numCliente, ").
Append("campo8 AS NombreSuc, ").
Append("campo19 AS pedido, ").
Append("campo20 AS division, ").
Append("campo21 AS efectuarPago, ").
Append("campo22 AS direccionPie, ").
Append("campo23 AS paraConsultas, ").
Append("campo26 AS cantidadLetra, ").
Append("campo27 AS zona, ").
Append("campo28 AS vencimiento, ").
Append("campo29 AS corporateCode, ").
Append("campo31 AS hyperion, ").
Append("campo32 AS INTERICOM, ").
Append("campo30 AS oldCorporateCode, ").
Append("campo33 AS referencia, ").
Append("campo34 AS fechaRefDoc, ").
Append("campo36 AS codigoCorporativo, ").
Append("campo37 AS codigoCorporativoAnt, ").
Append("campo38 AS clienteNo, ").
Append("campo39 AS contacto, ").
Append("campo40 AS observaciones, ").
Append("campo41 AS NoAp, ").
Append("campo42 AS AnoAp, ").
Append("' ' AS [ENTREGADO-A-NOMBRE], ").
Append("campo10 + ' ' + campo11 + ' ' + ").
Append("campo12 AS [ENTREGADO-A-CALLE], ").
Append("campo13 AS [ENTREGADO-A-COLONIA], ").
Append("campo18 AS [ENTREGADO-A-CP], ").
Append("campo15 AS [ENTREGADO-A-MUNIC], ").
Append("campo14 AS [ENTREGADO-A-LOCAL], ").
Append("campo16 AS [ENTREGADO-A-ESTADO], ").
Append("campo17 AS [ENTREGADO-A-PAIS] ").
Append("FROM opcionalEncabezado ").
Append("WHERE idCFDI = @0 AND ST = 1 ");
sbOpcionalDetalle.
Append("SELECT ").
Append("COALESCE(campo1, '') AS codeLocal, ").
Append("COALESCE(campo3, '') AS lote, ").
Append("COALESCE(campo4, '') AS cantidad, ").
Append("COALESCE(campo5, '') AS expiracion, ").
Append("COALESCE(campo6, '') AS taxRate, ").
Append("COALESCE(campo7, '') AS taxPaid, ").
Append("COALESCE(campo10, '') AS codeOracle, ").
Append("COALESCE(campo11, '') AS codeISPC, ").
Append("COALESCE(campo12, '') AS codeImpuesto, ").
Append("COALESCE(campo13, '') AS centroCostos, ").
Append("COALESCE(campo14, '') AS clinico, ").
Append("COALESCE(campo15, '') AS proyecto, ").
Append("COALESCE(campo16, '') AS cantidadReal, ").
Append("COALESCE(campo17, '') AS descuento, ").
Append("COALESCE(campo18, '') AS codBarras ").
Append("FROM opcionalDetalle ").
Append("WHERE idCFDI = @0 ");
sbDataEmisor.Append("SELECT nombreSucursal FROM sucursales WHERE idSucursal = @0 ");
dtOpcEnc = dal.QueryDT("DS_FE", sbOpcionalEncabezado.ToString(), "F:I:" + idCfdi, hc);
dtOpcDet = dal.QueryDT("DS_FE", sbOpcionalDetalle.ToString(), "F:I:" + idCfdi, hc);
dtDataEmisor = dal.QueryDT("DS_FE", sbDataEmisor.ToString(), "F:I:" + htFacturaxion["idSucursalEmisor"].ToString(), hc);
if (dtOpcDet.Rows.Count == 0)
{
for (int i = 1; i <= electronicDocument.Data.Conceptos.Count; i++)
{
dtOpcDet.Rows.Add("", "0.00");
}
}
#endregion
//.........这里部分代码省略.........
示例3: generarPdf
public static string generarPdf(Hashtable htFacturaxion, HttpContext hc)
{
string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
FileStream fs = new FileStream(pathPdf, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
try
{
StringBuilder sbConfigFact = new StringBuilder();
StringBuilder sbConfigFactParms = new StringBuilder();
_ci.NumberFormat.CurrencyDecimalDigits = 2;
DAL dal = new DAL();
ElectronicDocument electronicDocument = (ElectronicDocument)htFacturaxion["electronicDocument"];
Data objTimbre = (Data)htFacturaxion["objTimbre"];
bool timbrar = Convert.ToBoolean(htFacturaxion["timbrar"]);
//string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
// Obtenemos el logo y plantilla
StringBuilder sbLogo = new StringBuilder();
sbLogo.
Append("SELECT S.rutaLogo, P.rutaEncabezado, P.rutaFooter ").
Append("FROM sucursales S ").
Append("LEFT OUTER JOIN tipoPlantillas P ON S.idTipoPlantilla = P.idTipoPlantilla AND P.ST = 1 ").
Append("WHERE idSucursal = @0 AND S.ST = 1");
DataTable dtLogo = dal.QueryDT("DS_FE", sbLogo.ToString(), "F:I:" + htFacturaxion["idSucursalEmisor"], hc);
string rutaLogo = dtLogo.Rows[0]["rutaLogo"].ToString();
string rutaHeader = dtLogo.Rows[0]["rutaEncabezado"].ToString();
string rutaFooter = dtLogo.Rows[0]["rutaFooter"].ToString();
//Obtenemos Rol de la empresa
StringBuilder sbRol = new StringBuilder();
sbRol.
Append("DECLARE @iduser INT; ").
Append("SELECT DISTINCT @iduser = UxR.idUser FROM sucursales S ").
Append("LEFT OUTER JOIN sucursalesXUsuario SxU ON S.idSucursal = SxU.idSucursal LEFT OUTER JOIN r3TakeCore.dbo.SYS_UserXRol UxR ON UxR.idUser = SxU.idUser ").
Append("WHERE idEmpresa = @0 AND UxR.idRol IN(22,15) AND S.ST = 1 AND SxU.ST = 1; ").
Append("SELECT UxR.idRol FROM r3TakeCore.dbo.SYS_UserXRol UxR WHERE idUser = @idUser"); //Rol 15 > MIT ; 22 > Facturizate
int idRol = dal.ExecuteScalar("DS_FE", sbRol.ToString(), "F:S:" + htFacturaxion["idEmisor"], hc);
sbConfigFactParms.
Append("F:I:").Append(Convert.ToInt64(htFacturaxion["idSucursalEmisor"])).
Append(";").
Append("F:I:").Append(Convert.ToInt32(htFacturaxion["tipoComprobante"])).
Append(";").
Append("F:S:").Append(electronicDocument.Data.Total.Value).
Append(";").
Append("F:I:").Append(Convert.ToInt32(htFacturaxion["idMoneda"])).
Append(";").
Append("F:S:").Append(rutaLogo).
Append(";").
Append("F:S:").Append(rutaHeader).
Append(";").
Append("F:S:").Append(rutaFooter).
Append(";").
Append("F:I:").Append(Convert.ToInt64(htFacturaxion["idEmisor"]));
if (idRol == 15)
{
if (rutaHeader.Length > 0)
{
sbConfigFact.
Append("SELECT @5 AS rutaTemplateHeader, @6 AS rutaTemplateFooter, @4 AS rutaLogo, objDesc, posX, posY, fontSize, dbo.convertNumToTextFunction( @2, @3) AS cantidadLetra, ").
Append("logoPosX, logoPosY, headerPosX, headerPosY, footerPosX, footerPosY, conceptosColWidth, desgloseColWidth ").
Append("FROM configuracionFacturas CF ").
Append("LEFT OUTER JOIN sucursales S ON S.idSucursal = @0 ").
Append("LEFT OUTER JOIN configuracionFactDet CFD ON CF.idConFact = CFD.idConFact ").
Append("WHERE CF.ST = 1 AND CF.idEmpresa = -1 AND CF.idTipoComp = @1 AND idCFDProcedencia = 1 AND objDesc NOT LIKE 'nuevoLbl%' ");
}
else
{
sbConfigFact.
Append("SELECT rutaTemplateHeader, rutaTemplateFooter, @4 AS rutaLogo, objDesc, posX, posY, fontSize, dbo.convertNumToTextFunction( @2, @3) AS cantidadLetra, ").
Append("logoPosX, logoPosY, headerPosX, headerPosY, footerPosX, footerPosY, conceptosColWidth, desgloseColWidth ").
Append("FROM configuracionFacturas CF ").
Append("LEFT OUTER JOIN sucursales S ON S.idSucursal = @0 ").
Append("LEFT OUTER JOIN configuracionFactDet CFD ON CF.idConFact = CFD.idConFact ").
Append("WHERE CF.ST = 1 AND CF.idEmpresa = -1 AND CF.idTipoComp = @1 AND idCFDProcedencia = 1 AND objDesc NOT LIKE 'nuevoLbl%' ");
}
}
else
{
sbConfigFact.
Append("DECLARE @idEmpresa AS INT;").
Append("IF EXISTS (SELECT * FROM configuracionFacturas WHERE idEmpresa = @7) ").
Append("SET @idEmpresa = @7; ").
Append("ELSE ").
Append("SET @idEmpresa = 0; ").
Append("SELECT rutaTemplateHeader, rutaTemplateFooter, S.rutaLogo, objDesc, posX, posY, fontSize, dbo.convertNumToTextFunction( @2, @3) AS cantidadLetra, ").
Append("logoPosX, logoPosY, headerPosX, headerPosY, footerPosX, footerPosY, conceptosColWidth, desgloseColWidth, S.nombreSucursal ").
Append("FROM configuracionFacturas CF ").
Append("LEFT OUTER JOIN sucursales S ON S.idSucursal = @0 ").
Append("LEFT OUTER JOIN configuracionFactDet CFD ON CF.idConFact = CFD.idConFact ").
Append("WHERE CF.ST = 1 AND CF.idEmpresa = @idEmpresa AND CF.idTipoComp = @1 AND idCFDProcedencia = 1 AND objDesc NOT LIKE 'nuevoLbl%' ");
}
//.........这里部分代码省略.........
示例4: generarPdf
public static string generarPdf(Hashtable htFacturaxion, HttpContext hc)
{
string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
FileStream fs = new FileStream(pathPdf, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
try
{
DAL dal = new DAL();
StringBuilder sbConfigFactParms = new StringBuilder();
StringBuilder sbConfigFact = new StringBuilder();
StringBuilder sbDataEmisor = new StringBuilder();
StringBuilder sbOpcionalEncabezado = new StringBuilder();
DataTable dtConfigFact = new DataTable();
DataTable dtDataEmisor = new DataTable();
DataTable dtOpcEncabezado = new DataTable();
_ci.NumberFormat.CurrencyDecimalDigits = 4;
_c2.NumberFormat.CurrencyDecimalDigits = 2;
electronicDocument = (ElectronicDocument)htFacturaxion["electronicDocument"];
objTimbre = (Data)htFacturaxion["objTimbre"];
timbrar = Convert.ToBoolean(htFacturaxion["timbrar"]);
//pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
Int64 idCfdi = Convert.ToInt64(htFacturaxion["idCfdi"]);
#region "Extraemos los datos del CFDI"
sbConfigFactParms.
Append("F:I:").Append(Convert.ToInt64(htFacturaxion["idSucursalEmisor"])).
Append(";").
Append("F:I:").Append(Convert.ToInt32(htFacturaxion["tipoComprobante"])).
Append(";").
Append("F:S:").Append(electronicDocument.Data.Total.Value).
Append(";").
Append("F:I:").Append(Convert.ToInt32(htFacturaxion["idMoneda"])).
Append(";").
Append("F:I:").Append(Convert.ToInt64(htFacturaxion["idEmisor"]));
sbConfigFact.
Append("DECLARE @idEmpresa AS INT; SET @idEmpresa = 0; ").
Append("SELECT rutaTemplateHeader, CF.rutaLogo, objDesc, posX, posY, fontSize, dbo.convertNumToTextFunction( @2, @3) AS cantidadLetra, ").
Append("logoPosX, logoPosY, headerPosX, headerPosY, footerPosX, footerPosY, conceptosColWidth, desgloseColWidth, S.nombreSucursal ").
Append("FROM configuracionFacturas CF ").
Append("LEFT OUTER JOIN sucursales S ON S.idSucursal = @0 ").
Append("LEFT OUTER JOIN configuracionFactDet CFD ON CF.idConFact = CFD.idConFact ").
Append("WHERE CF.ST = 1 AND CF.idEmpresa = -1 AND CF.idTipoComp = @1 AND idCFDProcedencia = 1 AND objDesc NOT LIKE 'nuevoLbl%' ");
sbDataEmisor.
Append("SELECT nombreSucursal FROM sucursales WHERE idSucursal = @0 ");
sbOpcionalEncabezado.
Append("SELECT campo1 AS observaciones ").
//Append("campo2 AS observaciones2").
//Append("campo3 AS observaciones3").
Append("FROM opcionalEncabezado WHERE idCFDI = @0 and ST = 1");
dtConfigFact = dal.QueryDT("DS_FE", sbConfigFact.ToString(), sbConfigFactParms.ToString(), hc);
dtDataEmisor = dal.QueryDT("DS_FE", sbDataEmisor.ToString(), "F:I:" + htFacturaxion["idSucursalEmisor"].ToString(), hc);
dtOpcEncabezado = dal.QueryDT("DS_FE", sbOpcionalEncabezado.ToString(), "F:I:" + idCfdi, hc);
Hashtable htDatosCfdi = new Hashtable();
#region "Dirección Emisor"
StringBuilder sbDirEmisor1 = new StringBuilder();
StringBuilder sbDirEmisor2 = new StringBuilder();
StringBuilder sbDirEmisor3 = new StringBuilder();
if (electronicDocument.Data.Emisor.Domicilio.Calle.Value.Length > 0)
{
sbDirEmisor1.Append("Calle ").Append(electronicDocument.Data.Emisor.Domicilio.Calle.Value).Append(" ");
}
if (electronicDocument.Data.Emisor.Domicilio.NumeroExterior.Value.Length > 0)
{
sbDirEmisor1.Append(", No. Ext ").Append(electronicDocument.Data.Emisor.Domicilio.NumeroExterior.Value).Append(" ");
}
if (electronicDocument.Data.Emisor.Domicilio.NumeroInterior.Value.Length > 0)
{
sbDirEmisor1.Append(", No. Int ").Append(electronicDocument.Data.Emisor.Domicilio.NumeroInterior.Value);
}
if (electronicDocument.Data.Emisor.Domicilio.Colonia.Value.Length > 0)
{
sbDirEmisor2.Append("Col. ").Append(electronicDocument.Data.Emisor.Domicilio.Colonia.Value).Append(" ");
}
if (electronicDocument.Data.Emisor.Domicilio.CodigoPostal.Value.Length > 0)
{
sbDirEmisor2.Append(", C.P. ").Append(electronicDocument.Data.Emisor.Domicilio.CodigoPostal.Value).Append(" ");
}
if (electronicDocument.Data.Emisor.Domicilio.Localidad.Value.Length > 0)
{
sbDirEmisor2.Append(", ").Append(electronicDocument.Data.Emisor.Domicilio.Localidad.Value);
}
if (electronicDocument.Data.Emisor.Domicilio.Municipio.Value.Length > 0)
{
sbDirEmisor3.Append("Mpio. / Del. ").Append(electronicDocument.Data.Emisor.Domicilio.Municipio.Value).Append(" ");
//.........这里部分代码省略.........
示例5: generarPdf
public static string generarPdf(Hashtable htFacturaxion, HttpContext hc)
{
string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
FileStream fs = new FileStream(pathPdf, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
try
{
DAL dal = new DAL();
StringBuilder sbConfigFactParms = new StringBuilder();
_ci.NumberFormat.CurrencyDecimalDigits = 2;
ElectronicDocument electronicDocument = (ElectronicDocument)htFacturaxion["electronicDocument"];
Data objTimbre = (Data)htFacturaxion["objTimbre"];
timbrar = Convert.ToBoolean(htFacturaxion["timbrar"]);
Int64 idCfdi = Convert.ToInt64(htFacturaxion["idCfdi"]);
#region "Extraemos Datos Adicionales"
DataTable dtOpcionalDetalle = new DataTable();
StringBuilder sbOpcionalDetalle = new StringBuilder();
sbOpcionalDetalle.
Append("SELECT ").
Append("COALESCE(campo1, '0') AS noIdent ").
Append("FROM opcionalDetalle ").
Append("WHERE idCFDI = @0 ");
dtOpcionalDetalle = dal.QueryDT("DS_FE", sbOpcionalDetalle.ToString(), "F:I:" + idCfdi, hc);
if (dtOpcionalDetalle.Rows.Count == 0)
{
for (int i = 1; i <= electronicDocument.Data.Conceptos.Count; i++)
{
dtOpcionalDetalle.Rows.Add("0");
}
}
#endregion
#region "Extraemos los datos del CFDI"
Hashtable htDatosCfdi = new Hashtable();
htDatosCfdi.Add("nombreEmisor", electronicDocument.Data.Emisor.Nombre.Value);
htDatosCfdi.Add("rfcEmisor", electronicDocument.Data.Emisor.Rfc.Value);
htDatosCfdi.Add("nombreReceptor", electronicDocument.Data.Receptor.Nombre.Value);
htDatosCfdi.Add("rfcReceptor", electronicDocument.Data.Receptor.Rfc.Value);
htDatosCfdi.Add("serie", electronicDocument.Data.Serie.Value);
htDatosCfdi.Add("folio", electronicDocument.Data.Folio.Value);
htDatosCfdi.Add("fechaCfdi", electronicDocument.Data.Fecha.Value);
htDatosCfdi.Add("UUID", objTimbre.Uuid.Value);
#region "Dirección Emisor"
StringBuilder sbDirEmisor1 = new StringBuilder();
StringBuilder sbDirEmisor2 = new StringBuilder();
StringBuilder sbDirEmisor3 = new StringBuilder();
if (electronicDocument.Data.Emisor.Domicilio.Calle.Value.Length > 0)
{
sbDirEmisor1.Append(electronicDocument.Data.Emisor.Domicilio.Calle.Value).Append(" ");
}
if (electronicDocument.Data.Emisor.Domicilio.NumeroExterior.Value.Length > 0)
{
sbDirEmisor1.Append(electronicDocument.Data.Emisor.Domicilio.NumeroExterior.Value).Append(", ");
}
if (electronicDocument.Data.Emisor.Domicilio.NumeroInterior.Value.Length > 0)
{
sbDirEmisor1.Append(" ").Append(electronicDocument.Data.Emisor.Domicilio.NumeroInterior.Value).Append(", ");
}
if (electronicDocument.Data.Emisor.Domicilio.Colonia.Value.Length > 0)
{
sbDirEmisor2.Append(electronicDocument.Data.Emisor.Domicilio.Colonia.Value).Append(", ");
}
if (electronicDocument.Data.Emisor.Domicilio.Localidad.Value.Length > 0)
{
sbDirEmisor2.Append(electronicDocument.Data.Emisor.Domicilio.Localidad.Value);
}
if (electronicDocument.Data.Emisor.Domicilio.Municipio.Value.Length > 0)
{
sbDirEmisor3.Append(electronicDocument.Data.Emisor.Domicilio.Municipio.Value).Append(", ");
}
if (electronicDocument.Data.Emisor.Domicilio.Estado.Value.Length > 0)
{
sbDirEmisor3.Append(electronicDocument.Data.Emisor.Domicilio.Estado.Value).Append(" ");
}
if (electronicDocument.Data.Emisor.Domicilio.CodigoPostal.Value.Length > 0)
{
sbDirEmisor3.Append("C.P. ").Append(electronicDocument.Data.Emisor.Domicilio.CodigoPostal.Value).Append(", ");
}
sbDirEmisor3.Append(electronicDocument.Data.Emisor.Domicilio.Pais.Value);
#endregion
#region "Dirección Sucursal Expedido En"
StringBuilder sbDirExpedido1 = new StringBuilder();
StringBuilder sbDirExpedido2 = new StringBuilder();
StringBuilder sbDirExpedido3 = new StringBuilder();
if (electronicDocument.Data.Emisor.ExpedidoEn.Calle.Value.Length > 0)
//.........这里部分代码省略.........
示例6: formatoCED110324NN4
//.........这里部分代码省略.........
cellConceptos.HorizontalAlignment = PdfCell.ALIGN_LEFT;
tableConceptos.AddCell(cellConceptos);
cellConceptos = new PdfPCell(new Phrase(electronicDocument.Data.Conceptos[i].Descripcion.Value + "\nNo Identificación: " + dtOpcDet.Rows[i]["noIdent"].ToString(), new Font(Font.HELVETICA, 7, Font.NORMAL)));
cellConceptos.Border = 0;
tableConceptos.AddCell(cellConceptos);
cellMontos = new PdfPCell(new Phrase(electronicDocument.Data.Conceptos[i].ValorUnitario.Value.ToString("C", _ci), new Font(Font.HELVETICA, 7, Font.NORMAL)));
cellMontos.Border = 0;
cellMontos.HorizontalAlignment = PdfCell.ALIGN_JUSTIFIED;
tableConceptos.AddCell(cellMontos);
cellMontos = new PdfPCell(new Phrase(electronicDocument.Data.Conceptos[i].Importe.Value.ToString("C", _ci), new Font(Font.HELVETICA, 8, Font.NORMAL)));
cellMontos.Border = 0;
cellMontos.HorizontalAlignment = PdfCell.ALIGN_JUSTIFIED;
tableConceptos.AddCell(cellMontos);
}
#endregion
#region "Construimos el Comentarios"
Table comentarios = new Table(4);
float[] headerwidthsComentarios = { 25, 25, 35, 15 };
comentarios.Widths = headerwidthsComentarios;
comentarios.WidthPercentage = 100;
comentarios.Padding = 1;
comentarios.Spacing = 1;
comentarios.BorderWidth = 0;
comentarios.DefaultCellBorder = 0;
comentarios.BorderColor = gris;
int idMoneda = 1;
DataTable dtImporteLetra = dal.QueryDT("DS_FE", "SELECT dbo.convertNumToTextFunction(@0, @1) AS cantidadLetra", "F:S:" + electronicDocument.Data.Total.Value.ToString() + ";F:I:" + idMoneda, hc);
cel = new Cell(new Phrase("Importe con Letra:\n" + dtImporteLetra.Rows[0]["cantidadLetra"].ToString(), f6B));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_LEFT;
cel.BorderWidthTop = 1;
cel.BorderWidthLeft = 1;
cel.BorderWidthRight = 1;
cel.BorderWidthBottom = 1;
cel.BorderColor = gris;
cel.Colspan = 2;
cel.Rowspan = 3;
comentarios.AddCell(cel);
cel = new Cell(new Phrase("Sub Total:", f6B));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_RIGHT;
cel.BorderWidthTop = 1;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = 0;
cel.BorderWidthBottom = 0;
cel.BorderColor = gris;
comentarios.AddCell(cel);
cel = new Cell(new Phrase(electronicDocument.Data.SubTotal.Value.ToString("C", _ci), f6B));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_RIGHT;
cel.BorderWidthTop = 1;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = 1;
cel.BorderWidthBottom = 0;
cel.BorderColor = gris;
comentarios.AddCell(cel);
示例7: generarPdf
public static string generarPdf(Hashtable htFacturaxion, HttpContext hc)
{
try
{
DAL dal = new DAL();
_ci.NumberFormat.CurrencyDecimalDigits = 2;
string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
ElectronicDocument electronicDocument = (ElectronicDocument)htFacturaxion["electronicDocument"];
Data objTimbre = (Data)htFacturaxion["objTimbre"];
timbrar = Convert.ToBoolean(htFacturaxion["timbrar"]);
pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
Int64 idCfdi = Convert.ToInt64(htFacturaxion["idCfdi"]);
#region "Obtenemos los datos del CFDI y Campos Opcionales"
StringBuilder sbOpcionalEncabezado = new StringBuilder();
DataTable dtOpcEnc = new DataTable();
//StringBuilder sbOpcionalDetalle = new StringBuilder();
DataTable dtOpcDet = new DataTable();
StringBuilder sbDataEmisor = new StringBuilder();
DataTable dtDataEmisor = new DataTable();
sbOpcionalEncabezado.
Append("SELECT ").
Append("campo1 AS [NUMERO-POLIZA], ").
Append("campo2 AS [NUMERO-ENDOSO], ").
Append("campo3 AS [INICIO-VIGENCIA], ").
Append("campo4 AS [FIN-VIGENCIA], ").
Append("campo5 AS [CLAVE], ").
Append("campo6 AS [NOMBRE-AGENTE], ").
Append("campo9 AS [NUMERO-RECIBO], ").
Append("campo10 AS [FECHA-LIMITE], ").
Append("campo11 AS [SERIE-RECIBO], ").
Append("campo12 AS [ESQUEMA-PAGO], ").
Append("campo14 AS [BANCO], ").
Append("campo15 AS [PRIMA-NETA], ").
Append("campo16 AS [DERECHOS], ").
Append("campo17 AS [RECARGOS], ").
Append("campo18 AS [CANTIDAD-LETRA] ").
Append("FROM opcionalEncabezado ").
Append("WHERE idCFDI = @0 AND ST = 1 ");
//sbOpcionalDetalle.
// Append("SELECT ").
// Append("COALESCE(campo1, '') AS codeLocal, ").
// Append("COALESCE(campo3, '') AS lote, ").
// Append("COALESCE(campo4, '') AS cantidad, ").
// Append("COALESCE(campo5, '') AS expiracion, ").
// Append("COALESCE(campo6, '') AS taxRate, ").
// Append("COALESCE(campo7, '') AS taxPaid, ").
// Append("COALESCE(campo10, '') AS codeOracle, ").
// Append("COALESCE(campo11, '') AS codeISPC, ").
// Append("COALESCE(campo12, '') AS codeImpuesto, ").
// Append("COALESCE(campo13, '') AS centroCostos, ").
// Append("COALESCE(campo14, '') AS clinico, ").
// Append("COALESCE(campo15, '') AS proyecto, ").
// Append("COALESCE(campo16, '') AS cantidadReal, ").
// Append("COALESCE(campo17, '') AS descuento, ").
// Append("COALESCE(campo18, '') AS codBarras ").
// Append("FROM opcionalDetalle ").
// Append("WHERE idCFDI = @0 ");
sbDataEmisor.Append("SELECT nombreSucursal FROM sucursales WHERE idSucursal = @0 ");
dtOpcEnc = dal.QueryDT("DS_FE", sbOpcionalEncabezado.ToString(), "F:I:" + idCfdi, hc);
//dtOpcDet = dal.QueryDT("DS_FE", sbOpcionalDetalle.ToString(), "F:I:" + idCfdi, hc);
dtDataEmisor = dal.QueryDT("DS_FE", sbDataEmisor.ToString(), "F:I:" + htFacturaxion["idSucursalEmisor"],
hc);
//if (dtOpcDet.Rows.Count == 0)
//{
// for (int i = 1; i <= electronicDocument.Data.Conceptos.Count; i++)
// {
// dtOpcDet.Rows.Add("", "0.00");
// }
//}
#endregion
#region "Extraemos los datos del CFDI"
htFacturaxion.Add("nombreEmisor", electronicDocument.Data.Emisor.Nombre.Value);
htFacturaxion.Add("rfcEmisor", electronicDocument.Data.Emisor.Rfc.Value);
htFacturaxion.Add("nombreReceptor", electronicDocument.Data.Receptor.Nombre.Value);
htFacturaxion.Add("rfcReceptor", electronicDocument.Data.Receptor.Rfc.Value);
htFacturaxion.Add("sucursal", dtDataEmisor.Rows[0]["nombreSucursal"]);
htFacturaxion.Add("serie", electronicDocument.Data.Serie.Value);
htFacturaxion.Add("folio", electronicDocument.Data.Folio.Value);
htFacturaxion.Add("fechaCfdi", electronicDocument.Data.Fecha.Value);
htFacturaxion.Add("UUID", objTimbre.Uuid.Value);
#region "Dirección Emisor"
StringBuilder sbDirEmisor1 = new StringBuilder();
StringBuilder sbDirEmisor2 = new StringBuilder();
StringBuilder sbDirEmisor3 = new StringBuilder();
if (electronicDocument.Data.Emisor.Domicilio.Calle.Value.Length > 0)
{
//.........这里部分代码省略.........