Exemple #1
0
        void myDialog_UpdateRequested(object sender, EventArgs e)
        {
            CompraItem item = (e as FieldsUpdateEventArgs).UpdatedFields;

            AddItem(item, false);
            UpdateTotal();
            agreItem(item);
            m_fieldsPopup.Close();
        }
Exemple #2
0
        private void agreItem(CompraItem item)
        {
            //m_cliente = new Cliente();
            //item.Marca = m_cliente.Marci;

            //item.Numero_De_Documento = GlobalId.Identificador;
            item.Numero_De_Documento = osomaloso.ToString();
            item.Renglon             = estrella;
            descuento = item.Descuento;
            // item.Renglon = tabla.Rows.Count;
            tabla.Rows.Add(item.Numero_De_Documento, item.Renglon, item.Codigo, item.Descripcion, item.Unidad, item.Cantidad, item.Preciouni, item.Descuento, item.Preciocdesc, item.Precioextend);
            estrella = estrella + 1;
        }
        public CompraDialog(CompraItem newItem, string title)
        {
            InitializeComponent();


            dataGrid1.ShowGroupPanel = false;
            llenargrid();

            if (newItem == null)
            {
                //Cantidad.Value = GetQuantityAsInt();
                rate.Value = 0.00;
                //prueba usando datacontext
                //InvoiceItem newItem;
                newItem = new CompraItem();
            }

            item.Text = newItem.Codigo;

            item_Copy.Text = newItem.Descripcion;
            // newItem.Cantidad = GetQuantityAsInt();
            //newItem.Cantidad = 2;
            // rate.Value = 80.00;
            //llenarcombobox(item.Text);
            rate.Value     = 00.00;
            m_invoiceItem  = newItem;
            Cantidad.Value = newItem.Cantidad;


            //Cantidad.Value = 2;
            // rate.Value = 80.00;


            if (newItem.Cantidad == 0)
            {
                newItem.Cantidad    = GetQuantityAsInt();
                this.Cantidad.Value = 1;
                CalculateTax();
                UpdateTotalAmount();
            }
            //newItem.Codigo = item.Text;
            //
            // newItem.Descripcion = item_Copy.Text;
            // newItem.Cantidad = (double)Cantidad.Value;
            // newItem.Rate = (double)rate.Value;
            // m_invoiceItem = newItem;
            this.DataContext = m_invoiceItem;
            //// llenargrid();
        }
Exemple #4
0
        private void InvoiceGrid_DoubleTapped(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            FrameworkElement element = null;

            if ((element = e.OriginalSource as FrameworkElement) != null)
            {
                m_selectedIndex = Grid.GetRow(element);
            }
            CompraItem invoiceItem = m_items[m_selectedIndex];

            //esta no estaba comentada int selectedProductIndex = m_productList.IndexOf(m_productList[invoiceItem.Descripcion]);
            m_fieldsPopup = new CompraDialog(invoiceItem, "Edit the Fields");
            m_fieldsPopup.UpdateRequested += EditDialog_UpdateRequested;
            m_fieldsPopup.CloseRequested  += EditDialog_CloseRequested;
            m_fieldsPopup.lblTitle.Content = "Editar Articulos";
            RootGrid.Opacity      = 0.2;
            m_fieldsPopup.Opacity = 1;
            m_fieldsPopup.ShowDialog();
            RootGrid.Opacity = 1;
        }
Exemple #5
0
        public void AddItem(CompraItem item, bool addToGridAlone)
        {
            int rowIndex = m_currentRowIndex;

            if (!addToGridAlone)
            {
                m_items.Add(item);
            }

            if (!(InvoiceGrid.RowDefinitions.Count > m_currentRowIndex))
            {
                InvoiceGrid.RowDefinitions.Add(CreateRowDefinition(m_rowHeight));
            }
            DrawBorder(rowIndex);


            SetCell(rowIndex, 0, item.Codigo.ToString());
            SetCell(rowIndex, 1, item.Descripcion.ToString());
            SetCell(rowIndex, 2, item.Unidad.ToString());
            SetCell(rowIndex, 3, item.Cantidad.ToString());
            SetCell(rowIndex, 4, item.Preciouni.ToString("#,###.00", CultureInfo.InvariantCulture));
            SetCell(rowIndex, 5, item.Descuento.ToString());
            SetCell(rowIndex, 6, item.Descuento.ToString());
            SetCell(rowIndex, 7, item.Preciocdesc.ToString("#,###.00", CultureInfo.InvariantCulture));
            SetCell(rowIndex, 8, item.Precioextend.ToString("#,###.00", CultureInfo.InvariantCulture));
            //SetCell(rowIndex, 7, "$" + item.Total.ToString("#,###.00", CultureInfo.InvariantCulture));
            //SetCell(rowIndex, 8, "$" + item.Iva.ToString("#,###.00", CultureInfo.InvariantCulture));

            //<Rectangle Grid.Row="0" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5"
            //StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>

            m_totalDue  += Convert.ToDouble(item.Precioextend);
            m_totalsind += Convert.ToDouble(item.Precioextendsindesc);
            m_totalCant += Convert.ToDouble(item.Cantidad);

            m_currentRowIndex++;
            m_selectedIndex = m_items.Count;
            UpdateTotal();
            UpdateTotalsind();
            UpdateCantidad();
        }