Ejemplo n.º 1
0
        public override global::System.Data.DataSet Clone()
        {
            dsFactura cln = ((dsFactura)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Ejemplo n.º 2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            dsFactura ds = new dsFactura();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Ejemplo n.º 3
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                dsFactura ds = new dsFactura();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "DataTable1DataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Ejemplo n.º 4
0
        public FACTURA generarFACTURA(LIQUIDACION liquidacion, LIQUIDACION_DETALLE[] lstDetalles, VIEW_CLIENTE myCliente, Facturaconsecutivodetalle rango)
        {
            List <RECIBO>      lista              = null;
            dsFactura          dsFactura          = new dsFactura();
            FACTURACONSECUTIVO facturaConsecutivo = new FACTURACONSECUTIVO();

            facturaConsecutivoManagement = new FACTURACONSECUTIVOManagement();
            facturaManagement            = new FACTURAManagement();
            facturaConsecutivo.ID        = rango.ID_FACTURACONSECUTIVO;
            facturaConsecutivo           = facturaConsecutivoManagement.buscarPrimeroFACTURACONSECUTIVO(facturaConsecutivo);
            try
            {
                conn = conexion.conection();
                //int numRecibo = Funciones.getId(conn, "RECIBOS");

                DataRow drEscuela = dsFactura.ESCUELA.NewRow();
                Image   logo      = Resources.ResourceTmp.LogoConducimos;
                drEscuela["E_LOGO"]        = Funciones.Convertir_Imagen_Bytes(logo);
                drEscuela["E_NOMBRE"]      = "CENTRO DE ENSEÑANZA AUTOMOVILÍSTICA CONDUCIMOS S.A.S";
                drEscuela["E_NUM_RECIBO"]  = rango.CONSECUTIVO;// myFactura.NUMERO_FACTURA.ToString();
                drEscuela["E_FORMA_PAGO"]  = "Efectivo";
                drEscuela["E_SITIO_WEB"]   = "www.conducimos.com.co";
                drEscuela["E_NIT"]         = "900644828-1";
                drEscuela["E_DIRECCION"]   = "CRA 81 # 26-40";
                drEscuela["E_CIUDAD"]      = "Medellín";
                drEscuela["E_TELEFONO"]    = "2566295";
                drEscuela["E_CODIGO_CIIU"] = "8559";
                if (facturaConsecutivo != null && facturaConsecutivo.ID > 0)
                {
                    drEscuela["E_NUM_RESOLUCION"]   = facturaConsecutivo.RESOLUCION;
                    drEscuela["E_FECHA_RESOLUCION"] = facturaConsecutivo.FECHA_RESOLUCION.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("es-MX"));
                    drEscuela["E_RANGO_INICIAL"]    = facturaConsecutivo.RANGO_INICIAL;
                    drEscuela["E_RANGO_FINAL"]      = facturaConsecutivo.RANGO_FINAL;
                }
                dsFactura.ESCUELA.Rows.Add(drEscuela);

                DataRow drCliente = dsFactura.CLIENTE.NewRow();
                drCliente["C_TIPO_DOCUMENTO"]    = myCliente.TIPO_DOCUMENTO;
                drCliente["C_NOMBRES_APELLIDOS"] = myCliente.NOMBRES + " " + myCliente.APELLIDOS;
                drCliente["C_IDENTIFICACION"]    = myCliente.IDENTIFICACION;
                drCliente["C_DIRECCION"]         = myCliente.DIRECCION;
                drCliente["C_CIUDAD"]            = myCliente.CIUDAD;
                drCliente["C_TELEFONO"]          = myCliente.TELEFONO;
                drCliente["C_EMAIL"]             = myCliente.CORREO;
                dsFactura.CLIENTE.Rows.Add(drCliente);

                TARIFA_CONCEPTOManagement tarifa_conceptoManagement = new TARIFA_CONCEPTOManagement();
                TARIFA_DETALLEManagement  tarifa_detalleManagement  = new TARIFA_DETALLEManagement();

                foreach (LIQUIDACION_DETALLE dETALLE in lstDetalles)
                {
                    TARIFA_DETALLE tarifaDetalle = new TARIFA_DETALLE();
                    tarifaDetalle.ID = dETALLE.ID_TARIFA_DETALLE;
                    tarifaDetalle    = tarifa_detalleManagement.buscarPrimeroTARIFA_DETALLE(tarifaDetalle);
                    if (tarifaDetalle != null && tarifaDetalle.ID_TARIFA_CONCEPTO > 0)
                    {
                        TARIFA_CONCEPTO concepto = new TARIFA_CONCEPTO();
                        concepto.ID = tarifaDetalle.ID_TARIFA_CONCEPTO;
                        concepto    = tarifa_conceptoManagement.buscarPrimeroTARIFA_CONCEPTO(concepto);
                        if (concepto != null && concepto.ID > 0)
                        {
                            DataRow drLiquidacion = dsFactura.LIQUIDACION.NewRow();
                            drLiquidacion["L_CODIGO"]   = concepto.CODIGO;
                            drLiquidacion["L_CONCEPTO"] = concepto.NOMBRE;
                            drLiquidacion["L_CANTIDAD"] = 1;
                            drLiquidacion["L_UNIDAD"]   = 1;
                            drLiquidacion["L_VALOR"]    = dETALLE.VALOR_CONCEPTO;
                            drLiquidacion["L_IVA"]      = 0;
                            dsFactura.LIQUIDACION.Rows.Add(drLiquidacion);
                        }
                    }
                }

                String fileName = "Factura_" + myCliente.IDENTIFICACION.Trim() + "_No." + rango.CONSECUTIVO + "_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss.F") + ".pdf";
                fileName = fileName.Replace('/', '-');
                fileName = fileName.Replace(' ', '_');
                String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Facturas";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                path += "\\" + fileName;
                crFactura facturaCrystal = new crFactura();
                facturaCrystal.SetDataSource(dsFactura);
                facturaCrystal.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path);
                FACTURA factura = new FACTURA();
                factura.ARCHIVO_FISICO    = File.ReadAllBytes(path);
                factura.ID_FACTURA_ESTADO = 1;
                factura.ID_LIQUIDACION    = liquidacion.ID;
                factura.NUMERO_FACTURA    = rango.CONSECUTIVO.ToString();
                factura.DISPONIBLE        = "NO";
                factura = facturaManagement.crearFACTURA(factura);
                return(factura);
            }
            catch (Exception e)
            {
                return(null);
            }
            finally
            {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }