コード例 #1
0
        public DataTable detalleventa(string responsableiva)
        {
            string    precioneto  = "";
            decimal   var         = 0;
            DataTable datacliente = new DataTable();



            DataTable dt = new DataTable();

            dt.Columns.Add("Codigo", typeof(string));
            dt.Columns.Add("Precio", typeof(decimal));
            dt.Columns.Add("Cantidad", typeof(decimal));
            dt.Columns.Add("Descuento", typeof(decimal));
            dt.Columns.Add("Importe", typeof(decimal));
            dt.Columns.Add("Producto", typeof(string));
            dt.Columns.Add("Precioneto", typeof(string));
            dt.Columns.Add("Pesable", typeof(int));
            NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;



            DataTable ventas = NegocioVenta.MostrarDetalle(txtCodigo.Text);

            foreach (DataRow venta in ventas.Rows)
            {
                if (responsableiva != "EX")
                {
                    var = Decimal.Round(Convert.ToDecimal(venta["precio"]) / Convert.ToDecimal(1.21), 4);
                }
                else
                {
                    var = Decimal.Round(Convert.ToDecimal(venta["precio"]));
                }

                //Math.Round(decValue, 2, MidpointRounding.AwayFromZero)
                // var = Math.Round(var, 2, MidpointRounding.AwayFromZero);

                precioneto = var.ToString("0.0000", nfi);
                //recorro la lista pasado por paramentro y asigno al datatable para generar la transaccion
                //dt.Rows.Add(fila.Cells["Codigo"].Value, fila.Cells["Precio"].Value, fila.Cells["Cantidad"].Value, fila.Cells["Descuento"].Value, fila.Cells["Importe"].Value);
                // dt.Rows.Add(fila.Cells["Codigo"].Value, fila.Cells["Precio"].Value, fila.Cells["Cantidad"].Value, fila.Cells["Descuento"].Value, fila.Cells["Importe"].Value, fila.Cells["Producto"].Value, precioneto);


                //string tipo_comprobante = venta["tipo_comprobante"].ToString();
                //tipo_comprobante = tipo_comprobante == "V" ? "VENTA" : "";
                dt.Rows.Add(venta["idarticulo"], venta["precio"], venta["cantidad"], venta["descuento"], venta["importe"], venta["articulo"], precioneto, venta["Pesable"]);
                //
            }
            return(dt);
        }
コード例 #2
0
        private DataTable cargardetallestock(string codigoventa)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Codigo", typeof(string));
            dt.Columns.Add("Precio", typeof(decimal));
            dt.Columns.Add("PrecioVenta", typeof(decimal));
            dt.Columns.Add("Cantidad", typeof(string));
            dt.Columns.Add("StockActual", typeof(string));



            DataTable ventas = NegocioVenta.MostrarDetalle(codigoventa);

            foreach (DataRow venta in ventas.Rows)
            {
                //string tipo_comprobante = venta["tipo_comprobante"].ToString();
                //tipo_comprobante = tipo_comprobante == "V" ? "VENTA" : "";
                dt.Rows.Add(venta["idarticulo"], venta["precio"], venta["importe"], venta["cantidad"]);
                //
            }
            return(dt);
        }
コード例 #3
0
        private void dataLista_MouseClick(object sender, MouseEventArgs e)
        {
            DataGridViewRow row = dataLista.CurrentRow;

            if (e.Button == MouseButtons.Right)
            {
                if (Convert.ToBoolean(row.Cells["caja"].Value) == false && Convert.ToString(row.Cells["Tipo_comprobante"].Value) != "PRESUPUESTO")
                {
                    menuconfventa.Visible = true;
                }
                else
                {
                    menuconfventa.Visible = false;
                }

                contextMenuStrip1.Show(dataLista, new Point(e.X, e.Y));
            }

            if (e.Button == MouseButtons.Left)
            {
                DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
            }
        }
コード例 #4
0
        private void dataLista_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
            {
                DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
            }

            if (e.KeyCode == Keys.Enter)
            {
                if (dataLista.Rows.Count > 0)
                {
                    DateTime date = Convert.ToDateTime(this.dataLista.CurrentRow.Cells["fecha"].Value);

                    FrmDetalleVentas venta = new FrmDetalleVentas(Convert.ToString(this.dataLista.CurrentRow.Cells["codigo"].Value),
                                                                  Convert.ToString(this.dataLista.CurrentRow.Cells["razon_social"].Value),
                                                                  date.ToShortDateString(),
                                                                  Convert.ToString(this.dataLista.CurrentRow.Cells["tipo_comprobante"].Value),
                                                                  Convert.ToString(this.dataLista.CurrentRow.Cells["estado"].Value),
                                                                  Convert.ToString(Decimal.Round(Convert.ToDecimal(this.dataLista.CurrentRow.Cells["total"].Value), 2))
                                                                  , Convert.ToString(this.dataLista.CurrentRow.Cells["idcliente"].Value), Convert.ToString(this.dataLista.CurrentRow.Cells["cuit"].Value));
                    venta.ShowDialog();
                }
            }
        }
コード例 #5
0
        public void mostrar()
        {
            try
            {
                dataLista.Rows.Clear();
                DataTable ventas = NegocioVenta.MostrarDetalle(txtCodigo.Text);
                foreach (DataRow venta in ventas.Rows)
                {
                    //string tipo_comprobante = venta["tipo_comprobante"].ToString();
                    //tipo_comprobante = tipo_comprobante == "V" ? "VENTA" : "";
                    dataLista.Rows.Add(venta["idarticulo"], venta["articulo"], venta["precio"], venta["descuento"], venta["cantidad"], venta["importe"]);
                    //
                }

                //this.dataLista.Columns["precio"].DefaultCellStyle.Format = "c3";
                //this.dataLista.Columns["precio"].ValueType = Type.GetType("System.Decimal");
                //this.dataLista.Columns["precio"].DefaultCellStyle.Format = String.Format("###,##0.00");
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError("error con la Base de datos: " + ex.Message);
            }
            //datasource el origen de los datos,muestra las categorias en la grilla
        }
コード例 #6
0
 private void dataLista_SelectionChanged(object sender, EventArgs e)
 {
     DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
 }
コード例 #7
0
 private void dataLista_RowLeave(object sender, DataGridViewCellEventArgs e)
 {
     DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
 }