示例#1
0
        public DataSet factura(string encabezado, string detalle, string tipoDoc, string fact_num, string est)
        {
            RespuestaServicio respuesta = new RespuestaServicio();
            string            xml       = "";

            FACT_NUM          = fact_num;
            TIPODOC           = tipoDoc;
            Configuracion.DOC = tipoDoc;
            VFPData    data    = Deserialize <VFPData>(encabezado);
            VFPDataDet dataDet = DeserializeDetail <VFPDataDet>(detalle);

            xml = XML.setXML(data, dataDet, tipoDoc);
            saveXML(xml, fact_num, Configuracion.path);
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            com.guatefacturas.dte.Guatefac guatefac = new com.guatefacturas.dte.Guatefac();
            guatefac.Credentials     = new NetworkCredential(Configuracion.auth_user, Configuracion.auth_password);
            guatefac.PreAuthenticate = true;

            int    pTipoDoc = setTipoDoc(tipoDoc);
            string s        = guatefac
                              .generaDocumento(
                Configuracion.usuario,
                Configuracion.password,
                Configuracion.nit,
                Int32.Parse(est),
                pTipoDoc,
                Configuracion.maquina, "D", xml);

            return(generateDS(evaluateResponse(s)));
        }
示例#2
0
        public DataSet anular(string xml)
        {
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            com.guatefacturas.dte.Guatefac guatefac = new com.guatefacturas.dte.Guatefac();
            guatefac.Credentials     = new NetworkCredential(Configuracion.auth_user, Configuracion.auth_password);
            guatefac.PreAuthenticate = true;
            VFPData_an anular = DeserializeDetail <VFPData_an>(xml);
            string     nit    = Configuracion.nit;
            DateTime   oDate  = DateTime.Parse(anular.Temp_fact_detail.Pfechaanulacion);
            string     date   = formatDate(oDate);
            string     res    = guatefac.anulaDocumento(
                Configuracion.usuario,
                Configuracion.password,
                nit,
                anular.Temp_fact_detail.Pserie,
                anular.Temp_fact_detail.Ppreimpreso,
                anular.Temp_fact_detail.Pnitcomprador,
                //anular.Temp_fact_detail.Pfechaanulacion,
                date,
                anular.Temp_fact_detail.Pmotivoanulacion
                );

            return(generateDS(evaluateResponse(res)));
        }