public string formatoFS(Venta v)
        {
            double valorVenta = 0;
            string content =
                @"<html>
                    <body>
                        <table>
                            <tr>
                                <td>
                                    <span style='text-align: center; text-decoration: underline; font-size: 1em; font-weight: bold'>MadeInHouse S.A.</span><br>
                                    <span style='text-align: center; font-size: 0.5em'>
                                        Av. Priority N° xxx - San Miguel - Lima<br>
                                        Telf: 999-9999<br>
                                        www.MadeInHouse.com Email: [email protected]
                                    </span>
                                </td>
                                <td></td>
                                <td border=1>
                                    <span style='text-align: center; font-size: 1em'>
                                        R.U.C. N° XXXXXXXXXXX<br>
                                        FACTURA<br>
                                        001 - N° " + v.NumDocPagoServicio.ToString().PadLeft(10, '0');
            content += "</span>" +
                                "</td>" +
                            "</tr>" +
                        "</table>" +
                        "<br>" +
                        "<table width=100%>" +
                            "<tr>" +
                                "<td width=200 border=1>";
            if (v.IdCliente != -1)
            {
                ClienteSQL cSQL = new ClienteSQL();
                Cliente cli = cSQL.BuscarClienteByIdCliente(v.IdCliente);
                content += "<span style='font-size: 0.5em'>" +
                                        "Señor (es): " + cli.RazonSocial + "<br>" +
                                        "Dirección : " + cli.Direccion + "<br>" +
                                        "R.U.C. N° : " + cli.Ruc +
                                    "</span>";
            }
            else
            {
                content += "<span style='font-size: 0.5em'>" +
                                        "Señor (es): " + v.RazonSocial + "<br>" +
                                        "Dirección : " + v.Direccion + "<br>" +
                                        "R.U.C. N° : " + v.Ruc +
                                    "</span>";
            }
            content += "</td>" +
                                "<td width=100>" +
                                    "<table border=1 width=150 align=center>" +
                                        "<tr><td><span style='text-align: center; font-size: 0.5em'>FECHA DE EMISIÓN</span></td></tr>" +
                                        "<tr><td><span style='text-align: center; font-size: 0.5em'>" + DateTime.Now.ToString("dd/MM/yyyy") + "</span></td></tr>" +
                                    "</table>" +
                                "</td>" +
                            "</tr>" +
                        "</table>" +
                        "<br>" +
                        "<table border=1 height=700>" +
                            "<tr>" +
                                "<th><span style='font-size: 0.5em'>DESCRIPCION</span></th>" +
                                "<th><span style='font-size: 0.5em'>VALOR (S/.)</span></th>" +
                            "</tr>";
            if (v.LstDetalle != null)
            {
                foreach (DetalleVentaServicio dvs in v.LstDetalleServicio)
                {
                    content += "<tr>" +
                                "<td><span style='font-size: 0.5em'>" + dvs.Descripcion + "</span></th>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(valorVenta += (dvs.Precio / 1.18), 2) + "</span></th>" +
                                "</tr>";
                }
            }
            content += "</table>" +
                        "<br>" +
                        "<table border=1>" +
                            "<tr>" +
                                "<td><span style='font-size: 0.5em'>VALOR VENTA (S/.)</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(valorVenta, 2) + "</span></td>" +
                                "<td><span style='font-size: 0.5em'>IGV (S/.)</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(0.18 * valorVenta, 2) + "</span></td>" +
                                "<td><span style='font-size: 0.5em'>TOTAL A PAGAR (S/.)</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(1.18 * valorVenta, 2) + "</span></td>" +
                            "</tr>" +
                        "</table>" +
                    "</body>" +
                "</html>";

            return content;
        }
        public string formatoBP(Devolucion d, int num, List<DevolucionProducto> lstProductos)
        {
            double valorVenta = 0;
            double precioReal;
            num++;
            string content =
                @"<html>
                    <body>
                        <table>
                            <tr>
                                <td>
                                    <span style='text-align: center; text-decoration: underline; font-size: 1em; font-weight: bold'>MadeInHouse S.A.</span><br>
                                    <span style='text-align: center; font-size: 0.5em'>
                                        Av. Priority N° xxx - San Miguel - Lima<br>
                                        Telf: 999-9999<br>
                                        www.MadeInHouse.com Email: [email protected]
                                    </span>
                                </td>
                                <td></td>
                                <td border=1>
                                    <span style='text-align: center; font-size: 1em'>
                                        R.U.C. N° XXXXXXXXXXX<br>
                                        NOTA DE CREDITO<br>
                                        001 - N° " + (d.NumDocCredito = num.ToString().PadLeft(6, '0'));
            content +=              "</span>" +
                                "</td>" +
                            "</tr>" +
                        "</table>" +
                        "<br>" +
                        "<table width=100%>" +
                            "<tr>" +
                                "<td width=200 border=1>";
            if (d.venta.IdCliente > 0)
            {
                ClienteSQL cSQL = new ClienteSQL();
                Cliente cli = cSQL.BuscarClienteByIdCliente(d.venta.IdCliente);
                content += "<span style='font-size: 0.5em'>" +
                                        "Señor (es): " + cli.ApePaterno + " " + cli.ApeMaterno + ", " + cli.Nombre + "<br>" +
                                        "Dirección : " + cli.Direccion + "<br>" +
                                        "R.U.C. N° : " + cli.Ruc +
                                    "</span>";
            }
            else
            {
                content +=          "<span style='font-size: 0.5em'>" +
                                        "DNI: " + d.venta.dni + "<br>" +
                                    "</span>";
            }
            content += "</td>" +
                                "<td width=100>" +
                                    "<table border=1 width=150 align=center>" +
                                        "<tr><td><span style='text-align: center; font-size: 0.5em'>FECHA DE EMISIÓN</span></td></tr>" +
                                        "<tr><td><span style='text-align: center; font-size: 0.5em'>" + DateTime.Now.ToString("dd/MM/yyyy") + "</span></td></tr>" +
                                    "</table>" +
                                "</td>" +
                            "</tr>" +
                        "</table>" +
                        "<br>" +
                        "<table border=1 height=700>" +
                            "<tr>" +
                                "<th><span style='font-size: 0.5em'>CODIGO</span></th>" +
                                "<th><span style='font-size: 0.5em'>CANTIDAD</span></th>" +
                                "<th><span style='font-size: 0.5em'>DESCRIPCION</span></th>" +
                                "<th><span style='font-size: 0.5em'>PRECIO</span></th>" +
                                "<th><span style='font-size: 0.5em'>SUB TOTAL</span></th>" +
                            "</tr>";
            if (lstProductos != null)
            {
                foreach (DevolucionProducto prod in lstProductos)
                {
                    if (prod.Devuelve > 0)
                    {
                        content += "<tr>" +
                                    "<td><span style='font-size: 0.5em'>" + prod.CodProducto + "</span></th>" +
                                    "<td><span style='font-size: 0.5em'>" + prod.Devuelve + "</span></th>" +
                                    "<td><span style='font-size: 0.5em'>" + prod.Producto + "</span></th>" +
                                    "<td><span style='font-size: 0.5em'>" + Math.Round(precioReal = (prod.Precio / 1.18), 2) + "</span></th>" +
                                    "<td><span style='font-size: 0.5em'>" + Math.Round(valorVenta += prod.Devuelve * precioReal, 2) + "</span></th>" +
                                    "</tr>";

                    }
                }
            }
            content += "</table>" +
                        "<br>" +
                        "<table border=1>" +
                            "<tr>" +
                                "<td><span style='font-size: 0.5em'>VALOR VENTA</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(valorVenta, 2) + "</span></td>" +
                                "<td><span style='font-size: 0.5em'>IGV</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(0.18 * valorVenta, 2) + "</span></td>" +
                                "<td><span style='font-size: 0.5em'>TOTAL A PAGAR</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + (d.Monto = Math.Round(1.18 * valorVenta, 2)) + "</span></td>" +
                            "</tr>" +
                        "</table>" +
                    "</body>" +
                "</html>";

            return content;
        }
        public string formatoBP(Venta v)
        {
            double valorVenta = 0;
            double precioReal;
            string content =
                @"<html>
                    <body>
                        <table>
                            <tr>
                                <td>
                                    <span style='text-align: center; text-decoration: underline; font-size: 1em; font-weight: bold'>MadeInHouse S.A.</span><br>
                                    <span style='text-align: center; font-size: 0.5em'>
                                        Av. Priority N° xxx - San Miguel - Lima<br>
                                        Telf: 999-9999<br>
                                        www.MadeInHouse.com Email: [email protected]
                                    </span>
                                </td>
                                <td></td>
                                <td border=1>
                                    <span style='text-align: center; font-size: 1em'>
                                        R.U.C. N° XXXXXXXXXXX<br>
                                        BOLETA<br>
                                        001 - N° " + v.NumDocPago.ToString().PadLeft(10,'0');
            content += "</span>" +
                                "</td>" +
                            "</tr>" +
                        "</table>" +
                        "<br>" +
                        "<table width=100%>" +
                            "<tr>" +
                                "<td width=200 border=1>";
            if (v.IdCliente != -1)
            {
                ClienteSQL cSQL = new ClienteSQL();
                Cliente cli = cSQL.BuscarClienteByIdCliente(v.IdCliente);
                content += "<span style='font-size: 0.5em'>" +
                                        "Señor (es): " + cli.ApePaterno + " " + cli.ApeMaterno + ", " + cli.Nombre + "<br>" +
                                        "Dirección : " + cli.Direccion + "<br>" +
                                    "</span>";
            }
            else
            {
                content += "<span style='font-size: 0.5em'>" +
                                        "DNI: " + v.dni + "<br>" +
                                    "</span>";
            }
            content += "</td>" +
                                "<td width=100>" +
                                    "<table border=1 width=150 align=center>" +
                                        "<tr><td><span style='text-align: center; font-size: 0.5em'>FECHA DE EMISIÓN</span></td></tr>" +
                                        "<tr><td><span style='text-align: center; font-size: 0.5em'>" + DateTime.Now.ToString("dd/MM/yyyy") + "</span></td></tr>" +
                                    "</table>" +
                                "</td>" +
                            "</tr>" +
                        "</table>" +
                        "<br>" +
                        "<table border=1 height=700>" +
                            "<tr>" +
                                "<th><span style='font-size: 0.5em'>CODIGO</span></th>" +
                                "<th><span style='font-size: 0.5em'>CANTIDAD</span></th>" +
                                "<th><span style='font-size: 0.5em'>DESCRIPCION</span></th>" +
                                "<th><span style='font-size: 0.5em'>PRECIO (S/.)</span></th>" +
                                "<th><span style='font-size: 0.5em'>SUB TOTAL (S/.)</span></th>" +
                            "</tr>";
            if (v.LstDetalle != null)
            {
                foreach (DetalleVenta dv in v.LstDetalle)
                {
                    content += "<tr>" +
                                "<td><span style='font-size: 0.5em'>" + dv.CodProducto + "</span></th>" +
                                "<td><span style='font-size: 0.5em'>" + dv.Cantidad + "</span></th>" +
                                "<td><span style='font-size: 0.5em'>" + dv.Descripcion + "</span></th>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(precioReal = (dv.Precio / 1.18), 2) + "</span></th>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(valorVenta += dv.Cantidad * precioReal, 2) + "</span></th>" +
                                "</tr>";
                }
            }
            content += "</table>" +
                        "<br>" +
                        "<table border=1>" +
                            "<tr>" +
                                "<td><span style='font-size: 0.5em'>VALOR VENTA (S/.)</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(valorVenta, 2) + "</span></td>" +
                                "<td><span style='font-size: 0.5em'>IGV (S/.)</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(0.18 * valorVenta, 2) + "</span></td>" +
                                "<td><span style='font-size: 0.5em'>TOTAL A PAGAR (S/.)</span></td>" +
                                "<td><span style='font-size: 0.5em'>" + Math.Round(1.18 * valorVenta, 2) + "</span></td>" +
                            "</tr>" +
                        "</table>" +
                    "</body>" +
                "</html>";

            return content;
        }
 //sacara datos del cliente por DNI
 public void ExecuteFilterViewDNI(KeyEventArgs keyArgs)
 {
     if (keyArgs.Key == Key.Enter)
     {
         //buscar al cliente por la tarjeta
         ClienteSQL csql = new ClienteSQL();
         cliente = csql.BuscarClienteByDNI(TxtDNI);
         if (cliente != null)
         {
             TxtCliente = csql.BuscarTarjetaByIdCliente(cliente.Id);
             TxtRazonSocial = cliente.RazonSocial;
             TxtRuc = cliente.Ruc;
             TxtDNI = cliente.Dni;
         }
         else
         {
             MessageBox.Show("El DNI ingresado no corresponde a ningun cliente registrado", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
             TxtDNI = "";
         }
     }
 }
 //sacara datos del cliente por tarjeta
 public void ExecuteFilterView(KeyEventArgs keyArgs)
 {
     if (keyArgs.Key == Key.Enter)
     {
         //buscar al cliente por la tarjeta
         ClienteSQL csql = new ClienteSQL();
         cliente = csql.BuscarClienteByTarjeta(TxtCliente);
         if (cliente != null)
         {
             TxtRazonSocial = cliente.RazonSocial;
             TxtRuc = cliente.Ruc;
             TxtDNI = cliente.Dni;
         }
         else
         {
             MessageBox.Show("La tarjeta ingresada no se encuentra en el sistema", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
             TxtCliente = "";
         }
     }
 }
 public Cliente getClientefromID(int id)
 {
     Cliente c = new ClienteSQL().BuscarClienteByIdCliente(id);
     return c;
 }
 public void ExecuteFilterView(KeyEventArgs keyArgs)
 {
     Cliente c = new Cliente();
     if (keyArgs.Key == Key.Enter)
     {
         //buscar al cliente por la tarjeta
         ClienteSQL csql = new ClienteSQL();
         c = csql.BuscarClienteByTarjeta(TxtTarjetaCliente);
         if (c == null)
         {
             MessageBox.Show("La Tarjeta ingresada no esta registrata en el sistema", "AVISO", MessageBoxButton.OK, MessageBoxImage.Error);
             TxtTarjetaCliente = "";
             return;
         }
         TxtRazonSocial = c.RazonSocial;
         TxtRuc = c.Ruc.Trim();
         TxtCliente = c.NombreCompleto;
         cli.Cliente = c;
     }
 }