示例#1
0
        private void ButtonRecibo_Click(object sender, EventArgs e)
        {
            int    id    = Convert.ToInt32(VentaIdNumericUpDown.Value);
            Ventas venta = VentasBLL.Buscar(id);

            int           Id     = Convert.ToInt32(VentaIdNumericUpDown.Value);
            List <Ventas> ventas = new List <Ventas>();

            if (venta != null)
            {
                if (VentaIdNumericUpDown.Value > 0)
                {
                    ventas = VentasBLL.GetList(v => v.VentaId == Id);
                    vRecibo vRecibo = new vRecibo(ventas);
                    vRecibo.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Introduzca un Id!!", "Fallo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("No Hay Una Venta Con Ese Id!!", "Fallo",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void CVentas_Load(object sender, EventArgs e)
        {
            var listado = new List <Ventas>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltrarComboBox.SelectedIndex)
                {
                case 0:    //Todo
                    listado = VentasBLL.GetList(p => true);
                    break;

                case 1:
                    int id = Convert.ToInt32(CriterioTextBox.Text);
                    //listado = VentasBLL.GetList(p => p.CodigoCliente == id);
                    break;

                    //break;

                    //    case 5:
                    //        listado = VentasBLL.GetList(p => true);
                    //        /listado = listado.Where(c => DateTime.Parse(c.Fecha) >= DesdeDateTimePicker.Value.Date && DateTime.Parse(c.Fecha) <= HastaDateTimePicker.Value.Date).ToList();
                    //        break;
                }
                //listado = listado.Where(c => DateTime.Parse(c.Fecha) >= DesdeDateTimePicker.Value.Date && DateTime.Parse(c.Fecha) <= HastaDateTimePicker.Value.Date).ToList();
            }
            else
            {
                listado = VentasBLL.GetList(p => true);
            }

            ConsultaDataGridView.DataSource = null;
            ConsultaDataGridView.DataSource = listado;
        }
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            Contratos AnteriorContrato = ContratosBLL.Buscar(contrato.ContratoId);

            if (AnteriorContrato == null)
            {
                MessageBox.Show("No se Puede Eliminar un contrato que no existe");
                return;
            }

            List <Ventas> ventas = VentasBLL.GetList(p => true);

            foreach (var item in ventas)
            {
                if (item.VentaDetalle[0].ContratoId == contrato.ContratoId)
                {
                    MessageBox.Show("No se puede eliminar este contrato ya que tiene una venta");
                    return;
                }
            }

            if (ContratosBLL.Eliminar(contrato.ContratoId))
            {
                CacaosBLL.DevolverCacao(contrato.CacaoId, contrato.Cantidad);
                MessageBox.Show("Eliminado");
                Limpiar();
            }
            else
            {
                MessageBox.Show("No se puede eliminar un contrato que no existe");
            }
        }
示例#4
0
        public void GetListTest()
        {
            var lista = new List <Ventas>();

            lista = VentasBLL.GetList(p => true);
            Assert.IsNotNull(lista);
        }
示例#5
0
        public void GetListTest()
        {
            var listado = new List <Ventas>();

            listado = VentasBLL.GetList(s => true);
            Assert.AreEqual(listado, listado);
        }
示例#6
0
        private void ButtonBuscar_Click(object sender, EventArgs e)
        {
            ventas = VentasBLL.GetList(v => v.VentaId == id);
            vRecibo recibo = new vRecibo(ventas);

            recibo.ShowDialog();
            Hide();
        }
        public void BuscarTest()
        {
            int    idVenta = VentasBLL.GetList(x => true)[0].VentaId;
            Ventas ventas  = VentasBLL.Buscar(idVenta);
            bool   paso    = ventas.Detalle.Count > 0;

            Assert.AreEqual(true, paso);
        }
示例#8
0
        private void obtenerVentas(int id)
        {
            VentaComboBox.Items.Clear();

            List <Ventas> ventas = VentasBLL.GetList(v => v.ClienteId == id);

            foreach (var item in ventas)
            {
                VentaComboBox.Items.Add(item.VentaId);
            }
        }
示例#9
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Ventas>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = VentasBLL.GetList(e => e.VentaId == int.Parse(CriterioTextBox.Text));
                    break;

                case 1:
                    listado = VentasBLL.GetList(e => e.UsuarioId == int.Parse(CriterioTextBox.Text));
                    break;

                case 2:
                    listado = VentasBLL.GetList(e => e.ClienteId == int.Parse(CriterioTextBox.Text));
                    break;

                case 3:
                    listado = VentasBLL.GetList(e => e.PropiedadId == int.Parse(CriterioTextBox.Text));
                    break;

                case 4:
                    listado = VentasBLL.GetList(e => e.Descuento == float.Parse(CriterioTextBox.Text));
                    break;

                case 5:
                    listado = VentasBLL.GetList(e => e.TipoNegocio.Contains(CriterioTextBox.Text));
                    break;

                case 9:
                    listado = VentasBLL.GetList(e => e.Monto == float.Parse(CriterioTextBox.Text));
                    break;

                case 6:
                    listado = VentasBLL.GetList(e => e.Valor == int.Parse(CriterioTextBox.Text));
                    break;

                case 7:
                    listado = VentasBLL.GetList(e => e.NumCuotas == int.Parse(CriterioTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = VentasBLL.GetList(c => true);
            }
            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
        public void GetListTest()
        {
            bool paso = false;

            List <Ventas> lista = VentasBLL.GetList(l => true);

            if (lista != null)
            {
                paso = true;
            }

            Assert.AreEqual(paso, true);
        }
示例#11
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Ventas>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    try
                    {
                        listado = VentasBLL.GetList(p => p.VentaId == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 1:
                    try
                    {
                        listado = VentasBLL.GetList(p => p.ClienteId == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;
                }
            }
            else
            {
                //MessageBox.Show("Has dejado el Campo (Criterio) vacio.\n\nPor lo tanto, se mostrarán todos los Ventas", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information);
                listado = VentasBLL.GetList(c => true);
            }

            if (DesdeDatePicker.SelectedDate != null)
            {
                listado = VentasBLL.GetList(c => c.FechaF.Date >= DesdeDatePicker.SelectedDate);
            }

            if (HastaDatePicker.SelectedDate != null)
            {
                listado = VentasBLL.GetList(c => c.FechaF.Date <= HastaDatePicker.SelectedDate);
            }

            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
示例#12
0
        /*  private void DetalleDataGridVentas_AutoGeneratedColumns(object sender, EventArgs e)
         * {
         *    foreach (DataGridColumn item in DataGridConsulta.Columns)
         *    {
         *        chk = new CheckBox();
         *        checkBoxList.Add(chk);
         *        wrapColumns.Children.Add(chk);
         *        chk.Width = 100;
         *        chk.Height = 22;
         *        chk.Content = item.Header;
         *        chk.IsChecked = true;
         *        chk.Checked -= new RoutedEventHandler(chk_Checked);
         *        chk.Unchecked -= new RoutedEventHandler(chk_Unchecked);
         *    }
         * }
         *
         * void chk_Unchecked(object sender, RoutedEventArgs e) /// metodo para ocultar las columnas
         * {
         *    List<string> chkUnchekList = new List<string>();
         *    chkUnchekList.Clear();
         *
         *    foreach (CheckBox item in checkBoxList)
         *    {
         *        if (item.IsChecked == false)
         *        {
         *            chkUnchekList.Add(item.Content.ToString());
         *        }
         *    }
         *
         *    foreach (DataGridColumn item in DataGridConsulta.Columns)
         *    {
         *        if (chkUnchekList.Contains(item.Header.ToString()))
         *        {
         *            DataGridConsulta.Columns.Remove(item);
         *            break;
         *        }
         *    }
         * }
         *
         * void chk_Checked(object sender, RoutedEventArgs e) // metodo para mostrar las columnas
         * {
         *    DataGridConsulta.AutoGeneratedColumns -= new EventHandler(DetalleDataGridVentas_AutoGeneratedColumns);
         *
         *    List<string> chkCheckList = new List<string>();
         *    chkCheckList.Clear();
         *
         *    foreach (CheckBox item in checkBoxList)
         *    {
         *        if (item.IsChecked == false)
         *        {
         *            chkCheckList.Add(item.Content.ToString());
         *        }
         *    }
         *
         *    DataGridConsulta.ItemsSource = null;
         *    DataGridConsulta.ItemsSource = ocultardetalle;
         *
         *    foreach (string item in chkCheckList)
         *    {
         *        foreach (DataGridColumn column in DataGridConsulta.Columns)
         *        {
         *            if (column.Header.ToString() == item)
         *            {
         *                DataGridConsulta.Columns.Remove(column);
         *                break;
         *            }
         *        }
         *    }
         * }*/

        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Ventas>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:     //Todo
                    listado = VentasBLL.GetList(o => true);
                    break;

                case 1:
                    int id;
                    id      = int.Parse(CriterioTextBox.Text);
                    listado = VentasBLL.GetList(o => o.VentaId == id);
                    break;

                case 2:
                    int clienteId;
                    clienteId = int.Parse(CriterioTextBox.Text);
                    listado   = VentasBLL.GetList(o => o.ClienteId == clienteId);
                    break;

                case 3:    //Tipo Pago
                    string tipoPago;
                    tipoPago = Convert.ToString(CriterioTextBox.Text);
                    listado  = VentasBLL.GetList(o => o.TipoPago == tipoPago);
                    break;


                case 4:
                    decimal monto;
                    monto   = decimal.Parse(CriterioTextBox.Text);
                    listado = VentasBLL.GetList(o => o.Monto == monto);
                    break;
                }
            }
            else if (FiltroComboBox.SelectedIndex == 4)
            {
                listado = VentasBLL.GetList(c => c.Fecha.Date >= DesdeDatePicker.SelectedDate && c.Fecha.Date <= HastaDatePicker.SelectedDate);
            }
            else
            {
                listado = VentasBLL.GetList(p => true);
            }
            DataGridConsulta.ItemsSource = null;
            DataGridConsulta.ItemsSource = listado;
        }
        public PdfPTable AddId()
        {
            int       maxColumn = 1;
            PdfPTable pdfPTable = new PdfPTable(maxColumn);

            pdfCell                     = new PdfPCell(new Phrase(VentasBLL.GetList(p => true).Count.ToString(), fontFecha));
            pdfCell.Colspan             = maxColumn;
            pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            pdfCell.Border              = 0;
            pdfCell.ExtraParagraphSpace = 0;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();

            return(pdfPTable);
        }
示例#14
0
        public byte[] Reporte(List <Ventas> lista)
        {
            if (lista.Count < 1)
            {
                listaVentas = VentasBLL.GetList(c => true);
            }
            else
            {
                listaVentas = lista;
            }

            document = new Document(PageSize.Letter, 25f, 25f, 20f, 20f);
            pdfTable = new PdfPTable(columnas);

            pdfTable.WidthPercentage     = 100;
            pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;

            fontStyle = FontFactory.GetFont("Calibri", 8f, 1);

            PdfWriter.GetInstance(document, memoryStream);
            document.Open();

            float[] anchoColumnas = new float[columnas];

            anchoColumnas[0] = 115; //Esta sera la fila 1 VentaId
            anchoColumnas[1] = 100; //Esta sera la fila 2 fecha
            anchoColumnas[2] = 115; //Esta sera la fila 3 ClienteId
            anchoColumnas[3] = 200; //Esta sera la fila 4 Nombres
            anchoColumnas[4] = 180; //Esta sera la fila 5 Total
            anchoColumnas[5] = 180; //Esta sera la fila 6 Balance
            anchoColumnas[6] = 100; //Esta sera la fila 7 fechaCreacion
            anchoColumnas[7] = 100; //Esta sera la fila 8 fechaModificacion
            anchoColumnas[8] = 115; //Esta sera la fila 9 usuarioId

            pdfTable.SetWidths(anchoColumnas);

            this.ReportHeader();
            this.ReportBody();

            pdfTable.HeaderRows = 1;
            document.Add(pdfTable);
            document.Close();

            return(memoryStream.ToArray());
        }
示例#15
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            Expression <Func <Ventas, bool> > filtro = a => true;

            switch (FiltrarComboBox.SelectedIndex)
            {
            case 0:        //Fecha
                filtro = a => a.Fecha >= FechaDesdeDateTimePicker.Value.Date && a.Fecha <= FechaHastaDateTimePicker.Value.Date;
                break;

            case 1:        //Total
                filtro = a => a.TotalAPagar.Equals(CriterioTextBox.Text);
                break;
            }

            Listaventas = VentasBLL.GetList(filtro);
            ConsultaDataGridView.DataSource = Listaventas;
        }
        public void GetListTest()
        {
            var Listar = VentasBLL.GetList(x => true);

            Assert.IsNotNull(Listar);
        }
        public void GetListTest()
        {
            List <Ventas> listaVenta = VentasBLL.GetList(v => true);

            Assert.IsNotNull(listaVenta);
        }
        private void ButtonImprimir_Click(object sender, EventArgs e)
        {
            vVentas ver = new vVentas(VentasBLL.GetList(filtro));

            ver.Show();
        }
        private void ButtonBuscar_Click(object sender, EventArgs e)
        {
            switch (FiltroComboBox.SelectedIndex)
            {
            case 0:    //VentaId
                if (Validar(1))
                {
                    MessageBox.Show("Llenar Casilla ", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (Validar(2))
                {
                    MessageBox.Show("Ingrese un Numero!", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    int id = Convert.ToInt32(CriterioTextBox.Text);
                    if (FechaCheckBox.Checked == true)
                    {
                        filtro = x => x.VentaId == id &&
                                 (x.Fecha >= DesdeDateTimePicker.Value.Date &&
                                  x.Fecha <= HastaDateTimePicker.Value.Date);
                    }
                    else
                    {
                        filtro = x => x.VentaId == id;
                    }

                    if (VentasBLL.GetList(filtro).Count() == 0)
                    {
                        MessageBox.Show("No Hay Existencia", "Aviso",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                break;

            case 1:    //Descripcion

                if (Validar(1))
                {
                    MessageBox.Show("Llenar Casilla ", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (Validar(3))
                {
                    MessageBox.Show("Ingrese una Descripcion!", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (FechaCheckBox.Checked == true)
                    {
                        filtro = x => x.Descripcion.Contains(CriterioTextBox.Text) &&
                                 (x.Fecha >= DesdeDateTimePicker.Value.Date &&
                                  x.Fecha <= HastaDateTimePicker.Value.Date);
                    }
                    else
                    {
                        filtro = x => x.Descripcion.Contains(CriterioTextBox.Text);
                    }

                    if (VentasBLL.GetList(filtro).Count() == 0)
                    {
                        MessageBox.Show("No Hay Existencia", "Aviso",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                break;

            case 2:    //NombreCliente

                if (Validar(1))
                {
                    MessageBox.Show("Llenar Casilla ", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (Validar(3))
                {
                    MessageBox.Show("Ingrese un Nombre!", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (FechaCheckBox.Checked == true)
                    {
                        filtro = x => x.NombreCliente.Contains(CriterioTextBox.Text) &&
                                 (x.Fecha >= DesdeDateTimePicker.Value.Date &&
                                  x.Fecha <= HastaDateTimePicker.Value.Date);
                    }
                    else
                    {
                        filtro = x => x.NombreCliente.Contains(CriterioTextBox.Text);
                    }

                    if (VentasBLL.GetList(filtro).Count() == 0)
                    {
                        MessageBox.Show("No Hay Existencia", "Aviso",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                break;

            case 3:    //TelefonoCliente

                if (Validar(1))
                {
                    MessageBox.Show("Llenar Casilla ", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (Validar(2))
                {
                    MessageBox.Show("Ingrese un Telefono!", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (FechaCheckBox.Checked == true)
                    {
                        filtro = x => x.TelefonoCliente.Contains(CriterioTextBox.Text) &&
                                 (x.Fecha >= DesdeDateTimePicker.Value.Date &&
                                  x.Fecha <= HastaDateTimePicker.Value.Date);
                    }
                    else
                    {
                        filtro = x => x.TelefonoCliente.Contains(CriterioTextBox.Text);
                    }

                    if (VentasBLL.GetList(filtro).Count() == 0)
                    {
                        MessageBox.Show("No Hay Existencia", "Aviso",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                break;

            case 4:    //Total

                if (Validar(1))
                {
                    MessageBox.Show("Llenar Casilla!!", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (Validar(2))
                {
                    MessageBox.Show("Ingrese una Cantidad!!", "Fallido",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    decimal total = Convert.ToInt32(CriterioTextBox.Text);
                    if (FechaCheckBox.Checked == true)
                    {
                        filtro = x => x.Total == total &&
                                 (x.Fecha >= DesdeDateTimePicker.Value.Date &&
                                  x.Fecha <= HastaDateTimePicker.Value.Date);
                    }
                    else
                    {
                        filtro = x => x.Total == total;
                    }

                    if (VentasBLL.GetList(filtro).Count() == 0)
                    {
                        MessageBox.Show("No Hay Existencia", "Aviso",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                break;

            case 5:    //Todos
                filtro = x => true;
                break;
            }
            VentasDataGridView.DataSource = VentasBLL.GetList(filtro);
            VentasDataGridView.Columns["Detalle"].Visible = false;

            CriterioTextBox.Clear();
            GeneralErrorProvider.Clear();
        }
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var Listado = new List <Ventas>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:    //Todo
                    Listado = VentasBLL.GetList(v => true);
                    break;

                case 1:    //VentaId
                    try
                    {
                        int id = Convert.ToInt32(CriterioTextBox.Text);
                        Listado = VentasBLL.GetList(v => v.VentaId == id);
                        MessageBox.Show("ID");
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 2:    //ClienteId
                    try
                    {
                        int id = Convert.ToInt32(CriterioTextBox.Text);
                        Listado = VentasBLL.GetList(v => v.ClienteId == id);
                        MessageBox.Show("ID");
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 3:    //UsuarioId
                    try
                    {
                        int id = Convert.ToInt32(CriterioTextBox.Text);
                        Listado = VentasBLL.GetList(v => v.UsuarioId == id);
                        MessageBox.Show("ID");
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;
                }
                if (DesdeDatePicker.SelectedDate != null && HastaDatePicker.SelectedDate != null)
                {
                    Listado = Listado.Where(v => v.Fecha.Date >= DesdeDatePicker.SelectedDate.Value && v.Fecha.Date <= HastaDatePicker.SelectedDate.Value).ToList();
                }
            }
            else
            {
                Listado = VentasBLL.GetList(v => true);
            }

            List <VentaGrid> ventaGrid = new List <VentaGrid>();

            foreach (var item in Listado)
            {
                ventaGrid.Add(new VentaGrid(item.VentaId, item.Fecha, item.ClienteId, item.Total, item.Balance, item.FechaCreacion, item.FechaModificacion, item.UsuarioId));
            }

            ConsultaDataGrid.ItemsSource = null;
            ConsultaDataGrid.ItemsSource = ventaGrid;
        }
        private PdfPTable setPageTitle()
        {
            int       maxColumn = 2;
            PdfPTable pdfPTable = new PdfPTable(maxColumn);

            fontStyle = FontFactory.GetFont("Calibri", 18f, 1);
            fontFecha = FontFactory.GetFont("Calibri", 10f, 1);
            Titulo    = FontFactory.GetFont("Calibri", 25f, 1);

            pdfCell                     = new PdfPCell(new Phrase("Ferreteria FBF", Titulo));
            pdfCell.Colspan             = maxColumn;
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.Border              = 0;
            pdfCell.ExtraParagraphSpace = 0;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();
            if (venta.VentaId == 0)
            {
                pdfCell = new PdfPCell(new Phrase("No:  " + VentasBLL.GetList(p => true).Count.ToString(), fontFecha));
            }
            else
            {
                pdfCell = new PdfPCell(new Phrase("No:  " + venta.VentaId.ToString(), fontFecha));
            }
            pdfCell.Colspan             = maxColumn;
            pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            pdfCell.Border = 0;
            pdfCell.ExtraParagraphSpace = 0;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();

            if (venta.Tipo == "Credito")
            {
                pdfCell = new PdfPCell(new Phrase("Factura de venta a credito", fontStyle));
            }
            else
            {
                pdfCell = new PdfPCell(new Phrase("Factura de venta al contado", fontStyle));
            }

            pdfCell.Colspan             = maxColumn;
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.Border = 0;
            pdfCell.ExtraParagraphSpace = 0;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();

            pdfCell                     = new PdfPCell(new Phrase(DateTime.Now.ToString("MM/dd/yyyy H:mm tt"), fontFecha));
            pdfCell.Colspan             = maxColumn;
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.Border              = 0;
            pdfCell.ExtraParagraphSpace = 0;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();

            pdfCell                     = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.Colspan             = maxColumn;
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.Border              = 0;
            pdfCell.ExtraParagraphSpace = 0;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();

            return(pdfPTable);
        }
示例#22
0
 public void GetListTest()
 {
     Assert.IsTrue(VentasBLL.GetList(v => v.VentaId == 1) != null);
 }
        private void Buscar_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Ventas>();

            if (CriterioTexBox.Text.Trim().Length > 0)
            {
                switch (FiltroComBox.SelectedIndex)
                {
                case 0:
                    try
                    {
                        listado = VentasBLL.GetList(c => c.VentaId == int.Parse(CriterioTexBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 1:
                    try
                    {
                        listado = VentasBLL.GetList(c => c.ClienteId == int.Parse(CriterioTexBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;

                case 2:
                    try
                    {
                        listado = VentasBLL.GetList(c => c.FotografoId == int.Parse(CriterioTexBox.Text));
                    }
                    catch
                    {
                        MessageBox.Show("Por favor, ingrese un ID valido");
                    }
                    break;
                }
            }
            else
            {
                if (DesdeDataPicker.SelectedDate != null)
                {
                    listado = VentasBLL.GetList(c => c.Fecha.Date >= DesdeDataPicker.SelectedDate);
                }

                if (HastaDatePicker.SelectedDate != null)
                {
                    listado = VentasBLL.GetList(c => c.Fecha.Date <= HastaDatePicker.SelectedDate);
                }


                listado = VentasBLL.GetList(c => true);
            }

            ConsultaDataGrid.ItemsSource = null;
            ConsultaDataGrid.ItemsSource = listado;
        }