Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            int id;

            int.TryParse(ExportacionIdtextBox.Text, out id);
            Exportacion exportacion = new Exportacion();

            exportacion.ExportacionId = id;

            if (exportacion.Eliminar())
            {
                MessageBox.Show("Eliminado con exito!");
            }
        }
Пример #2
0
        private void Buscarbutton_Click(object sender, EventArgs e)
        {
            Lotes       lote        = new Lotes();
            Exportacion exportacion = new Exportacion();

            int.TryParse(ExportacionIdtextBox.Text, out idbuscado);
            lote.ExportacionId = idbuscado;
            lote.Buscar(idbuscado);

            exportacion.Fecha = FechadateTimePicker.Text;

            foreach (var item in exportacion.Lotes)
            {
                LotesdataGridView.Rows.Add(item.CodigoLote);
            }
        }
Пример #3
0
        public void Exportar(Exportacion exportacion)
        {
            AsignarRuta(exportacion.Entidad.ToString(), exportacion.FechaDelReporte);
            FileStream fileStream = new FileStream(ruta, FileMode.Create);

            fileStream.Close();
            string linea1 = $"{exportacion.Entidad};{exportacion.FechaDelReporte.ToString("dd/MM/yyyy")}";
            string linea2 = $"{exportacion.TotalRecaudado};{exportacion.CantidadDePagos}";

            this.Guardar(linea1);
            this.Guardar(linea2);
            foreach (var element in exportacion.consignaciones)
            {
                string linea = $"{element.NumeroDeRecibo};{element.FechaDePago.ToString("dd/MM/yyyy")};{element.ValorPagado}";
                this.Guardar(linea);
            }
        }
Пример #4
0
        public void Exportar()
        {
            RespuestaDeConsulta respuestaConsulta = new RespuestaDeConsulta();

            try
            {
                Entidad entidad = ConvertirEntidad(entidadBuscarCmb.Text);
                respuestaConsulta = consignacionService.ConsultarPorTipo(entidad);
                if (respuestaConsulta.Consignaciones.Count > 0)
                {
                    Respuesta respuesta = new Respuesta();
                    try
                    {
                        this.exportacion                 = new Exportacion();
                        this.exportacion.Entidad         = ConvertirEntidad(entidadBuscarCmb.Text);
                        this.exportacion.CantidadDePagos = consignacionService.TotalizarPorTipo(exportacion.Entidad);
                        this.exportacion.consignaciones  = respuestaConsulta.Consignaciones;
                        this.exportacion.FechaDelReporte = DateTime.Now.Date;
                        this.exportacion.TotalRecaudado  = consignacionService.TotalRecaudadoPorEntidad(exportacion.Entidad);
                        respuesta = exportacionService.ExportarConsignacion(exportacion);
                        Mensaje(respuesta);
                    }
                    catch (Exception ex)
                    {
                        respuesta.Mensaje = "ERROR ::" + ex.Message;
                        respuesta.Tipo    = TipoMensaje.ERROR;
                        Mensaje(respuesta);
                    }
                }
                else
                {
                    Mensaje(respuestaConsulta);
                }
            }
            catch (Exception ex)
            {
                respuestaConsulta.Mensaje        = "ERROR :: " + ex.Message;
                respuestaConsulta.Consignaciones = null;
                respuestaConsulta.Tipo           = TipoMensaje.ERROR;
                Mensaje(respuestaConsulta);
            }
        }
Пример #5
0
        private void Exportacionbutton_Click(object sender, EventArgs e)
        {
            Exportacion exp = new Exportacion();

            exp.Show();
        }
Пример #6
0
        public GTDocumento FExportacionXml(FacturaElectronicaGT Header, DataTable Detalle)
        {
            DireccionEmisor direccionEmisor = new DireccionEmisor
            {
                Direccion    = Header.DireccionEmisor,
                CodigoPostal = Header.CodigoPostalEmisor,
                Municipio    = Header.MunicipioEmisor,
                Departamento = Header.DepartamentoEmisor,
                Pais         = Header.PaisEmisor,
            };

            DireccionReceptor direccionReceptor = new DireccionReceptor
            {
                Direccion    = Header.DireccionReceptor,
                CodigoPostal = Header.CodigoPostalReceptor,
                Municipio    = Header.MunicipioReceptor,
                Departamento = Header.DepartamentoReceptor,
                Pais         = Header.PaisReceptor,
            };

            Frases frases = new Frases();

            //SI ES FACTURA DE EXPORTACION SE AGREGAR 3 LINEAS DE FRASES.
            if (Header.Exp.Equals("SI"))
            {
                frases.Frase = new List <Frase> {
                    new Frase {
                        CodigoEscenario = Header.CodigoEscenario, TipoFrase = Header.TipoFrase
                    },
                    new Frase {
                        CodigoEscenario = Header.CodigoEscenario, TipoFrase = "4"
                    }
                };
            }
            else
            {
                frases.Frase = new List <Frase> {
                    new Frase {
                        CodigoEscenario = Header.CodigoEscenario, TipoFrase = Header.TipoFrase
                    }
                };
            }

            TotalImpuestos TotalImpuestos = new TotalImpuestos
            {
                TotalImpuesto = new TotalImpuesto {
                    NombreCorto = "IVA", TotalMontoImpuesto = Header.TotalMontoImpuesto.ToString()
                },
            };

            Totales totales = new Totales
            {
                TotalImpuestos = new TotalImpuestos
                {
                    TotalImpuesto = new TotalImpuesto {
                        NombreCorto = "IVA", TotalMontoImpuesto = Header.TotalMontoImpuesto.ToString()
                    },
                },
                GranTotal = Header.GranTotal.ToString(),
            };

            List <Item>     item     = new List <Item>();
            List <Impuesto> impuesto = new List <Impuesto>();

            for (int i = 0; i <= Detalle.Rows.Count - 1; i++)
            {
                Impuestos impuestos = new Impuestos
                {
                    Impuesto = new Impuesto
                    {
                        NombreCorto          = "IVA",
                        CodigoUnidadGravable = Convert.ToDecimal(Detalle.Rows[i]["Impuesto"].ToString()) > 0 ?  "1" : "2",
                        MontoGravable        = Detalle.Rows[i]["Gravable"].ToString(),
                        MontoImpuesto        = Detalle.Rows[i]["Impuesto"].ToString(),
                    }
                };

                item.Add(new Item
                {
                    BienOServicio  = Detalle.Rows[i]["Tipo"].ToString().Equals("P") ? "B" : "S",
                    Cantidad       = Detalle.Rows[i]["Cantidad"].ToString(),
                    NumeroLinea    = (i + 1).ToString(),
                    UnidadMedida   = Detalle.Rows[i]["Unidad"].ToString(),
                    Descripcion    = Detalle.Rows[i]["Descripcion"].ToString(),
                    PrecioUnitario = Detalle.Rows[i]["Unitario"].ToString(),
                    Precio         = Detalle.Rows[i]["Precio"].ToString(),
                    Descuento      = Detalle.Rows[i]["Descuento"].ToString(),
                    Impuesto       = impuestos,
                    Total          = Detalle.Rows[i]["Total"].ToString(),
                });
            }

            Items items = new Items
            {
                Item = item,
            };

            //Cuando la factura es de credito se agrega el complemento.
            XmlFormatoFactura.Abono abono = new XmlFormatoFactura.Abono
            {
                NumeroAbono      = "1",
                FechaVencimiento = Header.Vencimiento,
                MontoAbono       = Header.GranTotal.ToString(),
            };

            XmlFormatoFactura.AbonosFacturaCambiaria abonoFC = new XmlFormatoFactura.AbonosFacturaCambiaria
            {
                Cfc            = "http://www.sat.gob.gt/dte/fel/CompCambiaria/0.1.0",
                Version        = "1",
                SchemaLocation = Header.SchemaLocation,
                Abono          = abono,
            };

            //Complemento complemento = new Complemento
            //{
            //    IDComplemento = "Cambiaria",
            //    NombreComplemento = "Cambiaria",
            //    URIComplemento = "http://www.sat.gob.gt/fel/cambiaria.xsd",
            //    AbonosFacturaCambiaria = abonoFC,
            //};

            Exportacion exportacion = new Exportacion
            {
                Cex            = "http://www.sat.gob.gt/face2/ComplementoExportaciones/0.1.0",
                Version        = "1",
                SchemaLocation = Header.SchemaLocation,
                NombreConsignatarioODestinatario    = Header.NombreConsignatarioODestinatario,
                DireccionConsignatarioODestinatario = Header.DireccionConsignatarioODestinatario,
                CodigoConsignatarioODestinatario    = Header.CodigoConsignatarioODestinatario,
                NombreComprador    = Header.NombreComprador,
                DireccionComprador = Header.DireccionComprador,
                CodigoComprador    = Header.CodigoComprador,
                OtraReferencia     = Header.OtraReferencia,
                INCOTERM           = Header.INCOTERM,
                NombreExportador   = Header.NombreExportador,
                CodigoExportador   = Header.CodigoExportador,
            };

            //Complemento complemento = new Complemento
            //{
            //    IDComplemento = "Exportacion",
            //    NombreComplemento = "Exportacion",
            //    URIComplemento = "http://www.sat.gob.gt/fel/exportacion.xsd",
            //    Exportacion = exportacion,
            //};

            List <Complemento> complementoList = new List <Complemento> {
                new Complemento {
                    IDComplemento     = "Exportacion",
                    NombreComplemento = "Exportacion",
                    URIComplemento    = "http://www.sat.gob.gt/fel/exportacion.xsd",
                    Exportacion       = exportacion,
                },
                new Complemento {
                    IDComplemento          = "Cambiaria",
                    NombreComplemento      = "Cambiaria",
                    URIComplemento         = "http://www.sat.gob.gt/fel/cambiaria.xsd",
                    AbonosFacturaCambiaria = abonoFC,
                },
            };

            Complementos complementos = new Complementos
            {
                //Complemento = complemento
                Complemento = complementoList
            };

            DatosEmision datosEmision = new DatosEmision
            {
                ID             = "DatosEmision",
                DatosGenerales = new DatosGenerales
                {
                    CodigoMoneda     = Header.CodigoMoneda,
                    FechaHoraEmision = Header.FechaHoraEmision,
                    Tipo             = Header.Tipo,
                    Exp = Header.Exp,
                },
                Emisor = new Emisor
                {
                    AfiliacionIVA         = Header.AfiliacionIVA,
                    CodigoEstablecimiento = Header.CodigoEstablecimiento,
                    CorreoEmisor          = Header.CorreoEmisor,
                    NITEmisor             = Header.NITEmisor,
                    NombreComercial       = Header.NombreComercial,
                    NombreEmisor          = Header.NombreEmisor,
                    DireccionEmisor       = direccionEmisor,
                },

                Receptor = new Receptor
                {
                    DireccionReceptor = direccionReceptor,
                    CorreoReceptor    = Header.CorreoReceptor,
                    IDReceptor        = Header.IDReceptor,
                    NombreReceptor    = Header.NombreReceptor,
                },

                Frases       = frases,
                Items        = items,
                Totales      = totales,
                Complementos = complementos,
            };

            DTE dte = new DTE
            {
                ID           = "DatosCertificados",
                DatosEmision = datosEmision,
            };

            SAT sat = new SAT
            {
                ClaseDocumento = "dte",
                DTE            = dte,
            };

            return(new GTDocumento
            {
                SAT = sat,
            });
        }