public string Encode(QREncodeVersion version, ETipoEntidad tipo, object source)
        {
            String txtEncodeData = string.Empty;

            txtEncodeData = "<l v=" + ((long)version).ToString() + " t=" + ((long)tipo).ToString() + " oid=OID_ITEM>";

            switch (tipo)
            {
            case ETipoEntidad.FacturaEmitida:
            {
                OutputInvoicePrint item = (OutputInvoicePrint)source;

                txtEncodeData = txtEncodeData.Replace("OID_ITEM", item.Oid.ToString());

                txtEncodeData += "<p>"
                                 + item.NumeroSerie + "|"
                                 + item.Fecha.ToShortDateString() + "|"
                                 + item.VatNumber + "|"
                                 + item.Codigo + "|"
                                 + item.Cliente + "|"
                                 + item.BaseImponible.ToString() + "|"
                                 + item.Impuestos.ToString() + "|"
                                 + item.Total.ToString() + "|"
                                 + "</p>";
            }
            break;

            case ETipoEntidad.Cobro:
            {
                CobroPrint item = (CobroPrint)source;

                txtEncodeData = txtEncodeData.Replace("OID_ITEM", item.Oid.ToString());

                txtEncodeData += "<p>"
                                 + item.Codigo + "|"
                                 + item.Fecha.ToShortDateString() + "|"
                                 + item.IDCobroS + "|"
                                 + item.EMedioPagoPrintLabel + "|"
                                 + item.NCliente + "|"
                                 + item.Cliente + "|"
                                 + item.Importe + "|"
                                 + item.CuentaBancaria + "|"
                                 + "</p>";

                if (item.CobroFacturas != null)
                {
                    txtEncodeData += "<sl t=" + ((long)ETipoEntidad.CobroFactura).ToString() + ">";

                    foreach (CobroFacturaInfo cf in item.CobroFacturas)
                    {
                        txtEncodeData += "<p>"
                                         + cf.CodigoFactura + "|"
                                         + cf.Cantidad + "|"
                                         + "</p>";
                    }

                    txtEncodeData += "</sl>";
                }
            }
            break;
            }

            txtEncodeData += "</l>";
            return(txtEncodeData);
        }
예제 #2
0
        public string Encode(QREncodeVersion version, ETipoEntidad tipo, object source)
        {
            String txtEncodeData = string.Empty;

            txtEncodeData = "<l v=" + ((long)version).ToString() + " t=" + ((long)tipo).ToString() + " oid=OID_ITEM>";

            switch (tipo)
            {
            case moleQule.Common.Structs.ETipoEntidad.FacturaRecibida:
            {
                InputInvoicePrint item = (InputInvoicePrint)source;

                txtEncodeData = txtEncodeData.Replace("OID_ITEM", item.Oid.ToString());

                txtEncodeData += "<p>"
                                 + item.Codigo + "|"
                                 + item.NSerie + "|"
                                 + item.Fecha.ToShortDateString() + "|"
                                 + item.VatNumber + "|"
                                 + item.NumeroAcreedor + "|"
                                 + item.Acreedor + "|"
                                 + item.BaseImponible.ToString() + "|"
                                 + item.ImporteIgic.ToString() + "|"
                                 + item.Total.ToString() + "|"
                                 + "</p>";
            }
            break;

            case moleQule.Common.Structs.ETipoEntidad.Pago:
            {
                PaymentPrint item = (PaymentPrint)source;

                txtEncodeData = txtEncodeData.Replace("OID_ITEM", item.Oid.ToString());

                txtEncodeData += "<p>"
                                 + item.Codigo + "|"
                                 + item.Fecha.ToShortDateString() + "|"
                                 + item.IDPagoS + "|"
                                 + item.EMedioPagoPrintLabel + "|"
                                 + item.CodigoAgente + "|"
                                 + item.Agente + "|"
                                 + item.Importe + "|"
                                 + item.CuentaBancaria + "|"
                                 + "</p>";

                if (item.Operations != null)
                {
                    txtEncodeData += "<sl t=" + ((long)moleQule.Common.Structs.ETipoEntidad.PagoFactura).ToString() + ">";

                    foreach (TransactionPaymentInfo cf in item.Operations)
                    {
                        txtEncodeData += "<p>"
                                         + cf.CodigoFactura + "|"
                                         + cf.Cantidad + "|"
                                         + "</p>";
                    }

                    txtEncodeData += "</sl>";
                }
            }
            break;
            }

            txtEncodeData += "</l>";
            return(txtEncodeData);
        }