Пример #1
0
        /// <summary>
        /// ------------------------------------------- Cantidad con Enter ----------------------------------
        /// </summary>

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            String Id   = TxCodigo.Text;
            String tipo = "codigo";

            if ((int)e.KeyChar == (int)Keys.Enter)
            {
                TxCodigo.Focus();
                consulta(tipo, Id);
            }
            else if ((int)e.KeyChar == (int)Keys.Back)
            {
            }
        }
Пример #2
0
 private void BtnNuevo_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         clean();
         activeSave(true, "Guardar");
         desbloquePanel(true);
         TxCodigo.Focus();
     }
     catch (Exception w)
     {
         MessageBox.Show("error en el btn nuevo:" + w);
     }
 }
Пример #3
0
        public void resultado()
        {
            try
            {
                String nombre = tablaVenta.CurrentRow.Cells[2].Value.ToString();

                int    cant  = int.Parse(txCantidad.Text);
                int    dispo = Convert.ToInt32(tablaVenta.CurrentRow.Cells[3].Value);
                int    prec  = Convert.ToInt32(tablaVenta.CurrentRow.Cells[5].Value);
                int    sub   = Convert.ToInt32(tablaVenta.CurrentRow.Cells[7].Value);
                double iva   = Convert.ToDouble(tablaVenta.CurrentRow.Cells[6].Value);
                iva = iva / prec;
                Console.WriteLine(iva);

                if (dispo >= cant && dispo > 0)
                {
                    sub = cant * prec;
                    double ivaTotal = (cant * prec) * iva;

                    tablaVenta.Rows[tablaVenta.CurrentRow.Index].Cells[4].Value = cant;
                    tablaVenta.Rows[tablaVenta.CurrentRow.Index].Cells[6].Value = ivaTotal;
                    tablaVenta.Rows[tablaVenta.CurrentRow.Index].Cells[7].Value = sub;


                    detallesPago();
                    subt   = 0;
                    ivaFin = 0;
                    cont4  = 0;
                    catch3 = catch3 - cant;
                }
                else
                {
                    MessageBox.Show("No Hay Suficientes Ariculos de " + nombre);
                    txCantidad.Text = dispo + "";
                    key             = true;
                    txCantidad.Focus();
                }
            }
            catch
            {
                MessageBox.Show("Debe Seleccionar primero el Producto!! F**K!!", "Error 1313", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxCodigo.Focus();
            }
        }
Пример #4
0
        /// <summary>
        /// ---------------- ASIGNAR CANTIDAD -------------------------
        /// </summary>

        private void textBox1_Leave(object sender, EventArgs e)
        {
            if (key)
            {
                cont4++;
                TxCodigo.Text = "";
                TxCodigo.Focus();

                if (cont4 > 0)
                {
                    resultado();
                }
                txCantidad.Text = "1";
            }
            else
            {
                key = true;
            }
        }
Пример #5
0
        private void btFactura_Click(object sender, EventArgs e)
        {
            if (cxVendedores.Text != "<--Seleccione-->")
            {
                Console.WriteLine("" + idVendedor);
                Console.WriteLine("" + Log.sucurId);
                Console.WriteLine("" + txSubtotal.Text);
                Console.WriteLine("" + txIva.Text);
                Console.WriteLine("" + txTotal.Text);
                Console.WriteLine("" + lbFecha.Text);

                // Console.WriteLine("" +);

                ConexionBD.SQL("INSERT INTO ventas VALUES(NULL, '" + idVendedor + "','" + txCliente.Text + "', NULL, '"
                               + Log.sucurId + "','" + txSubtotal.Text + "','" + txIva.Text + "','" + txTotal.Text + "','" + lbFecha.Text + "')");

                //MessageBox.Show("Inserto Factura..........................");

                for (int j = 0; j < tablaVenta.RowCount; j++)
                {
                    subt   = subt + int.Parse(tablaVenta.Rows[j].Cells[7].Value.ToString());
                    ivaFin = ivaFin + double.Parse(tablaVenta.Rows[j].Cells[6].Value.ToString());
                    ConexionBD.SQL("INSERT INTO detalles VALUES (NULL, '" + CoansecutivoFac.Text + "', '" + tablaVenta.Rows[j].Cells[1].Value.ToString()
                                   + "','" + tablaVenta.Rows[j].Cells[4].Value.ToString() + "','" + tablaVenta.Rows[j].Cells[5].Value.ToString() + "','"
                                   + tablaVenta.Rows[j].Cells[6].Value.ToString() + "','" + tablaVenta.Rows[j].Cells[7].Value.ToString() + "')");

                    //MessageBox.Show("Inserto Detalle No " + j + "..........................");
                }



                CrearTicket tk = new CrearTicket();
                tk.AbreCajon();
                tk.TextoCentrado("DISSFRUTA");
                tk.TextoIzquierda("EXPEDIDO EN: Cali");
                tk.TextoIzquierda("DIR: Ciudad Jardin");
                tk.TextoIzquierda("TEL: 314 786 02 94");
                tk.TextoIzquierda("EMAIL: [email protected]");
                tk.TextoIzquierda("");
                tk.TextoExtremos("Caja # 1", "Ticket #" + NoFactura.Text + CoansecutivoFac.Text);
                tk.lineasAsteriscos();

                tk.TextoIzquierda("");
                tk.TextoIzquierda("ATENDIO: " + cxVendedores.SelectedItem);
                tk.TextoIzquierda("CLIENTE: " + txCliente.Text);
                tk.TextoIzquierda("FECHA: " + DateTime.Now.ToShortDateString() + " HORA: " + DateTime.Now.ToShortTimeString());
                tk.lineasAsteriscos();

                tk.EncabezadoVenta();
                tk.lineasAsteriscos();
                MessageBox.Show("Inserto Detalle No " + tablaVenta.RowCount + "algo");
                for (int j = 0; j < tablaVenta.RowCount; j++)
                {
                    MessageBox.Show("Inserto Detalle No " + tablaVenta.Rows[j].Cells[2].Value.ToString() + "........jjj..................");
                    tk.AgregarArticulos(tablaVenta.Rows[j].Cells[2].Value.ToString(), int.Parse(tablaVenta.Rows[j].Cells[4].Value.ToString()),
                                        decimal.Parse(tablaVenta.Rows[j].Cells[5].Value.ToString()), decimal.Parse(tablaVenta.Rows[j].Cells[6].Value.ToString()));
                }

                //foreach (DataGridViewRow fila in tablaVenta.Rows)
                //{
                //    MessageBox.Show("Inserto Detalle No " + fila.Cells[2].Value.ToString() + "........jjj..................");
                //    tk.AgregarArticulos(fila.Cells[2].Value.ToString(), int.Parse(fila.Cells[4].Value.ToString()),
                //        decimal.Parse(fila.Cells[5].Value.ToString()), decimal.Parse(fila.Cells[6].Value.ToString()));
                //}

                tk.lineasIgual();

                tk.AgregarTotales("          SUBTOTAL......$", decimal.Parse(txSubtotal.Text));
                tk.AgregarTotales("          IVA...........$", decimal.Parse(txIva.Text));
                tk.AgregarTotales("          TOTAL.........$", decimal.Parse(txTotal.Text));
                tk.TextoIzquierda("");
                tk.AgregarTotales("          EFECTIVO......$", 2000);
                tk.AgregarTotales("          CAMBIO........$", 0);

                tk.TextoIzquierda("");
                tk.TextoIzquierda("ARTICULOS VENDIDOS : " + tablaVenta.RowCount);
                tk.TextoIzquierda("");
                tk.TextoCentrado("GRACIAS POR SU COMPRA by: J.J.");
                tk.CortarTicket();
                tk.ImprimirTicket("Microsoft XPS Document Writer");

                tablaVenta.DataSource = null;
                TxCodigo.Text         = "";
                TxCodigo.Focus();
                txCantidad.Text            = "";
                cxVendedores.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("Debe Primero Un Vendedor!! F**K!!", "Error 1313", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }