Beispiel #1
0
        public User(ConecDBmySql dataBase, FormUser Pantala)
        {
            this.pantala       = Pantala;
            this.DataBase      = dataBase;
            this.dataTablaUser = new DataTable();


            String consulta = "select id_cedulaEmpleado,nomUser as User,claveUser as Clave,titulo as Titulo,id_privilegios " +
                              "from tb_user, tb_previlegios where tb_user.id_privilegios = tb_previlegios.id_previlegios;";

            this.DataBase.GetDataTabla(consulta, this.dataTablaUser);
            if (this.DataBase.Error != null)
            {
                MessageBox.Show(this.DataBase.Error);
                this.pantala.Close();
            }
        }
Beispiel #2
0
        public FormUser(FormMain main)
        {
            InitializeComponent();
            this.Main = main;

            this.DataBase = new ConecDBmySql("127.0.0.1", "root", "Fred9845", "abc_barcelona");

            if (this.DataBase.Error != null)
            {
                MessageBox.Show(this.DataBase.Error);
                this.Main.Close();
            }
            else
            {
                this.Main.DataBase = this.DataBase;
                this.user          = new User(this.DataBase, this);
            }
        }
Beispiel #3
0
        public Facturacion(Panel Pantalla, ConecDBmySql DataBase, Point ubicacion, Size tamaño)
        {
            #region inicializacion de Objetos
            this.dataBase = DataBase;
            //this.data_Descuento = new DataTable();
            this.data_iva           = new DataTable();
            this.pantalla           = new Panel();
            this.groupCliente       = new GroupBox();
            this.FuenteLeta         = new Font(groupCliente.Font.Name, groupCliente.Font.Size, groupCliente.Font.Style);
            this.dataGVDetallesFact = new DataGridView();
            this.infoFactura        = new Panel();
            #endregion
            Pantalla.Controls.Add(this.pantalla);
            this.pantalla.Location  = ubicacion;
            this.pantalla.Size      = tamaño;
            this.pantalla.BackColor = Color.White;
            this.pantalla.Hide();

            #region Agregando Objetos a la Pantalla
            this.pantalla.Controls.Add(this.groupCliente);
            this.pantalla.Controls.Add(this.dataGVDetallesFact);
            this.pantalla.Controls.Add(this.infoFactura);
            #endregion

            #region Configurando Objetos groupCliente

            #region Inicializa Objetos
            this.lbNomCliente    = new Label();
            this.txtNomCliente   = new TextBox();
            this.lbFonoCliente   = new Label();
            this.txtFonoCliente  = new TextBox();
            this.lbDirecCliente  = new Label();
            this.txtDirecCliente = new TextBox();
            this.lbRucCliente    = new Label();
            this.txtRucCliente   = new TextBox();
            this.btBuscarNombre  = new Button();
            this.btBuscarCI      = new Button();
            this.btNewCliente    = new Button();
            this.lbFactura       = new Label();
            this.lbNumeroFactura = new Label();
            this.lbVerFecha      = new Label();
            this.lbfecha         = new Label();
            #endregion

            #region Agregando Objetos a la groupCliente
            this.groupCliente.Controls.Add(this.lbRucCliente);
            this.groupCliente.Controls.Add(this.txtRucCliente);
            this.groupCliente.Controls.Add(this.lbNomCliente);
            this.groupCliente.Controls.Add(this.txtNomCliente);
            this.groupCliente.Controls.Add(this.lbFonoCliente);
            this.groupCliente.Controls.Add(this.txtFonoCliente);
            this.groupCliente.Controls.Add(this.lbDirecCliente);
            this.groupCliente.Controls.Add(this.txtDirecCliente);
            this.groupCliente.Controls.Add(this.btNewCliente);
            this.groupCliente.Controls.Add(this.btBuscarNombre);
            this.groupCliente.Controls.Add(this.btBuscarCI);
            this.groupCliente.Controls.Add(this.lbfecha);
            this.groupCliente.Controls.Add(this.lbVerFecha);
            this.groupCliente.Controls.Add(this.lbNumeroFactura);
            this.groupCliente.Controls.Add(this.lbFactura);
            #endregion

            #region Comfiguracion Asset Cliente
            int marge        = 20;
            int separacion   = 10;
            int ancho        = this.pantalla.Size.Width - (marge * 2);
            int altoObjetos  = this.txtRucCliente.Size.Height;
            int anchoBotones = 60 * 2;
            int anchoLabel   = 75;
            // objetos Label
            this.lbRucCliente.Name       = "lbRucCliente";
            this.lbRucCliente.Text       = "Cedula o Ruc:";
            this.lbRucCliente.Location   = new Point(marge, marge);
            this.lbRucCliente.Size       = new Size(anchoLabel, altoObjetos);
            this.txtRucCliente.Name      = "txtRucCliente";
            this.txtRucCliente.Location  = new Point(this.lbRucCliente.Location.X + this.lbRucCliente.Size.Width + separacion, this.lbRucCliente.Location.Y - 4);
            this.txtRucCliente.Size      = new Size((ancho / 3) - this.lbRucCliente.Size.Width, altoObjetos);
            this.txtRucCliente.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TxtNumero_KeyPress);
            this.txtRucCliente.MaxLength = 13;

            this.btBuscarCI.Name      = "btBuscarCI";
            this.btBuscarCI.Text      = "Buscar por Ruc o CI";
            this.btBuscarCI.Location  = new Point(this.txtRucCliente.Location.X + this.txtRucCliente.Size.Width + separacion, this.txtRucCliente.Location.Y);
            this.btBuscarCI.Size      = new Size(anchoBotones, altoObjetos);
            this.btBuscarCI.BackColor = Color.White;

            this.lbNomCliente.Name      = "lbNomCliente";
            this.lbNomCliente.Text      = "Nombre:";
            this.lbNomCliente.Location  = new Point(marge, this.lbRucCliente.Location.Y + this.lbRucCliente.Size.Height + separacion);
            this.lbNomCliente.Size      = new Size(anchoLabel, altoObjetos);
            this.txtNomCliente.Name     = "txtNomCliente";
            this.txtNomCliente.Location = new Point(this.lbNomCliente.Location.X + this.lbNomCliente.Size.Width + separacion, this.lbNomCliente.Location.Y - 4);
            this.txtNomCliente.Size     = new Size((ancho / 3) - this.lbNomCliente.Size.Width, altoObjetos);
            this.txtNomCliente.Enabled  = false;

            this.btBuscarNombre.Name      = "btBuscarNombre";
            this.btBuscarNombre.Text      = "Buscar por Nombre";
            this.btBuscarNombre.Location  = new Point(this.txtNomCliente.Location.X + this.txtNomCliente.Size.Width + separacion, this.txtNomCliente.Location.Y);
            this.btBuscarNombre.Size      = new Size(anchoBotones, altoObjetos);
            this.btBuscarNombre.BackColor = Color.White;

            this.lbFonoCliente.Name      = "lbRucCliente";
            this.lbFonoCliente.Text      = "Telefono:";
            this.lbFonoCliente.Location  = new Point(marge, this.lbNomCliente.Location.Y + this.lbNomCliente.Size.Height + separacion);
            this.lbFonoCliente.Size      = new Size(anchoLabel, altoObjetos);
            this.txtFonoCliente.Name     = "txtFonoCliente";
            this.txtFonoCliente.Location = new Point(this.lbFonoCliente.Location.X + this.lbFonoCliente.Size.Width + separacion, this.lbFonoCliente.Location.Y - 4);
            this.txtFonoCliente.Size     = new Size((ancho / 3) - this.lbFonoCliente.Size.Width, altoObjetos);
            this.txtFonoCliente.Enabled  = false;

            this.btNewCliente.Name      = "btNewCliente";
            this.btNewCliente.Text      = "Nuevo Cliente";
            this.btNewCliente.Location  = new Point(this.txtFonoCliente.Location.X + this.txtFonoCliente.Size.Width + separacion, this.txtFonoCliente.Location.Y);
            this.btNewCliente.Size      = new Size(anchoBotones, altoObjetos);
            this.btNewCliente.BackColor = Color.White;

            this.lbDirecCliente.Name      = "lbDirecCliente";
            this.lbDirecCliente.Text      = "Direccion:";
            this.lbDirecCliente.Location  = new Point(this.btBuscarCI.Location.X + this.btBuscarCI.Size.Width + separacion, marge);
            this.lbDirecCliente.Size      = new Size(anchoLabel, altoObjetos);
            this.txtDirecCliente.Name     = "txtDirecCliente";
            this.txtDirecCliente.Location = new Point(this.lbDirecCliente.Location.X + this.lbDirecCliente.Size.Width + separacion, this.lbDirecCliente.Location.Y - 4);
            this.txtDirecCliente.Size     = new Size(ancho - this.txtDirecCliente.Location.X - marge, altoObjetos);
            this.txtDirecCliente.Enabled  = false;
            #endregion

            this.groupCliente.Name      = "groupCliente";
            this.groupCliente.Text      = "Datos del Cliente";
            this.groupCliente.Location  = new Point(marge, marge - 4);
            this.groupCliente.Size      = new Size(this.txtDirecCliente.Location.X + this.txtDirecCliente.Size.Width + marge, this.btNewCliente.Location.Y + this.btNewCliente.Size.Height + marge - 6);
            this.groupCliente.TabStop   = false;
            this.groupCliente.BackColor = Color.LightGray;

            #region Configuracion Asset Informacion de Factura
            float tamañoFontSize = this.FuenteLeta.Size + 10.0f;
            int   y          = this.lbfecha.Size.Height + 3;
            int   poinYfecha = ((this.groupCliente.Size.Height - this.txtDirecCliente.Location.Y + this.txtDirecCliente.Size.Height) / 2);
            this.lbfecha.Name     = "lbfecha";
            this.lbfecha.Text     = "Fecha:";
            this.lbfecha.Font     = new Font(this.FuenteLeta.Name, tamañoFontSize, FontStyle.Bold);
            this.lbfecha.Location = new Point(this.btBuscarNombre.Location.X + this.btBuscarNombre.Size.Width + separacion, poinYfecha);
            this.lbfecha.Size     = new Size(100, this.lbfecha.Size.Height + 3);

            this.lbVerFecha.Name      = "lbVerFecha";
            this.lbVerFecha.Text      = DateTime.Now.ToString("dd/MM/yyyy");
            this.lbVerFecha.Font      = new Font(this.FuenteLeta.Name, tamañoFontSize, FontStyle.Regular);
            this.lbVerFecha.Location  = new Point(this.lbfecha.Location.X + this.lbfecha.Size.Width, poinYfecha);
            this.lbVerFecha.Size      = new Size(200, this.lbfecha.Size.Height);
            this.lbVerFecha.ForeColor = Color.Blue;

            this.lbFactura.Name     = "lbFactura";
            this.lbFactura.Text     = "N° Factura:";
            this.lbFactura.Font     = new Font(this.FuenteLeta.Name, tamañoFontSize, FontStyle.Bold);
            this.lbFactura.Location = new Point(this.lbVerFecha.Location.X + this.lbVerFecha.Size.Width + separacion, poinYfecha);
            this.lbFactura.Size     = new Size(160, this.lbfecha.Size.Height + 3);

            this.lbNumeroFactura.Name      = "lbNumFactua";
            this.lbNumeroFactura.Text      = "000-000-000";
            this.lbNumeroFactura.Font      = new Font(this.FuenteLeta.Name, tamañoFontSize, FontStyle.Regular);
            this.lbNumeroFactura.Location  = new Point(this.lbFactura.Location.X + this.lbFactura.Size.Width, poinYfecha);
            this.lbNumeroFactura.Size      = new Size(200, this.lbfecha.Size.Height);
            this.lbNumeroFactura.ForeColor = Color.Red;
            #endregion

            #endregion

            #region configuracion Asset Detalle de factura

            this.dataGVDetallesFact.Name     = "dataGVDetallesFact";
            this.dataGVDetallesFact.Location = new Point(this.groupCliente.Location.X, this.groupCliente.Location.Y + this.groupCliente.Size.Height + 10);
            this.dataGVDetallesFact.Size     = new Size(this.groupCliente.Size.Width, (this.pantalla.Size.Height - this.dataGVDetallesFact.Location.Y) - this.groupCliente.Size.Height);
            //this.dataGVDetallesFact.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TxtNumero_KeyPress);

            if (dataGVDetallesFact.Columns.Count.Equals(0))

            {
                DataGridViewTextBoxColumn idProdu = new DataGridViewTextBoxColumn();
                idProdu.HeaderText     = "Codigo";
                idProdu.Name           = "id_bodegaProdutos";
                idProdu.Width          = 75;
                idProdu.MaxInputLength = 5;



                DataGridViewTextBoxColumn CantidaProdu = new DataGridViewTextBoxColumn();
                CantidaProdu.HeaderText     = "Cantidad";
                CantidaProdu.Name           = "cantidad";
                CantidaProdu.Width          = 75;
                CantidaProdu.MaxInputLength = 5;

                DataGridViewTextBoxColumn PrecioUProdu = new DataGridViewTextBoxColumn();
                PrecioUProdu.HeaderText = "Precio Unitario";
                PrecioUProdu.Name       = "precioUnitario";
                PrecioUProdu.Width      = 175;
                PrecioUProdu.ReadOnly   = true;

                DataGridViewTextBoxColumn PrecioTProdu = new DataGridViewTextBoxColumn();
                PrecioTProdu.HeaderText = "Precio Final";
                PrecioTProdu.Name       = "precioTotal";
                PrecioTProdu.Width      = 175;
                PrecioTProdu.ReadOnly   = true;

                DataGridViewTextBoxColumn nombreProdu = new DataGridViewTextBoxColumn();
                nombreProdu.HeaderText = "Producto";
                nombreProdu.Name       = "nombre";
                nombreProdu.Width      = dataGVDetallesFact.Size.Width - idProdu.Width - CantidaProdu.Width - PrecioUProdu.Width - PrecioTProdu.Width;
                nombreProdu.ReadOnly   = true;

                dataGVDetallesFact.Columns.Add(idProdu);
                dataGVDetallesFact.Columns.Add(nombreProdu);
                dataGVDetallesFact.Columns.Add(CantidaProdu);
                dataGVDetallesFact.Columns.Add(PrecioUProdu);
                dataGVDetallesFact.Columns.Add(PrecioTProdu);
            }
            #endregion

            #region Informacion de Factura

            #region Inicializa Objetos
            this.lb_nombreEmpreado = new Label();
            this.lb_subTotal       = new Label();
            this.lb_valorSubTotal  = new Label();
            this.lb_descuento      = new Label();
            this.lb_valorDescuento = new Label();
            this.txtDescuento      = new TextBox();
            this.lb_iva            = new Label();
            this.lb_valorIva       = new Label();
            this.lb_total          = new Label();
            this.lb_valorTotal     = new Label();
            this.bt_imprimir       = new Button();
            #endregion

            this.infoFactura.Name      = "infoFactura";
            this.infoFactura.Location  = new Point(this.dataGVDetallesFact.Location.X, this.dataGVDetallesFact.Location.Y + this.dataGVDetallesFact.Size.Height + 10);
            this.infoFactura.Size      = new Size(this.dataGVDetallesFact.Size.Width, ((this.pantalla.Size.Height - this.dataGVDetallesFact.Size.Height) - this.groupCliente.Size.Height) - 50);
            this.infoFactura.BackColor = Color.LightGray;

            #region Agregar Objetos al Panel infoFactura
            this.infoFactura.Controls.Add(this.lb_subTotal);
            this.infoFactura.Controls.Add(this.lb_valorSubTotal);
            this.infoFactura.Controls.Add(this.lb_descuento);
            this.infoFactura.Controls.Add(this.lb_valorDescuento);
            this.infoFactura.Controls.Add(this.txtDescuento);
            this.infoFactura.Controls.Add(this.lb_iva);
            this.infoFactura.Controls.Add(this.lb_valorIva);
            this.infoFactura.Controls.Add(this.lb_total);
            this.infoFactura.Controls.Add(this.lb_valorTotal);
            this.infoFactura.Controls.Add(this.lb_nombreEmpreado);
            this.infoFactura.Controls.Add(this.bt_imprimir);
            #endregion

            #region Configuracion Objetos

            int   margenIF      = 10;
            float tamañoLetraIF = this.FuenteLeta.Size + 4.0f;
            int   separacionIF  = 10;

            this.lb_subTotal.Name     = "lbRucCliente";
            this.lb_subTotal.Text     = "SubTotal: $";
            this.lb_subTotal.Location = new Point(margenIF, margenIF);
            this.lb_subTotal.AutoSize = true;
            this.lb_subTotal.Font     = new Font(this.FuenteLeta.Name, tamañoLetraIF, FontStyle.Regular);

            this.lb_valorSubTotal.Name      = "lb_valorSubTotal";
            this.lb_valorSubTotal.Text      = "0.00";
            this.lb_valorSubTotal.Location  = new Point(this.lb_subTotal.Location.X + this.lb_subTotal.Size.Width, margenIF);
            this.lb_valorSubTotal.AutoSize  = true;
            this.lb_valorSubTotal.ForeColor = Color.DarkBlue;
            this.lb_valorSubTotal.Font      = this.lb_subTotal.Font;

            this.lb_descuento.Name     = "lb_descuento";
            this.lb_descuento.Text     = "Descuento: $";
            this.lb_descuento.Location = new Point(this.lb_valorSubTotal.Location.X + this.lb_valorSubTotal.Size.Width + separacionIF, margenIF);
            this.lb_descuento.AutoSize = true;
            this.lb_descuento.Font     = this.lb_subTotal.Font;

            this.lb_valorDescuento.Name      = "lb_valorDescuento";
            this.lb_valorDescuento.Text      = "0.00";
            this.lb_valorDescuento.Location  = new Point(this.lb_descuento.Location.X + this.lb_descuento.Size.Width, margenIF);
            this.lb_valorDescuento.AutoSize  = true;
            this.lb_valorDescuento.ForeColor = Color.DarkBlue;
            this.lb_valorDescuento.Font      = this.lb_subTotal.Font;

            this.txtDescuento.Name      = "txtDescuento";
            this.txtDescuento.Text      = "0%";
            this.txtDescuento.Location  = new Point(this.lb_valorDescuento.Location.X + this.lb_valorDescuento.Size.Width + separacionIF, margenIF - 4);
            this.txtDescuento.AutoSize  = true;
            this.txtDescuento.ForeColor = Color.DarkBlue;
            this.txtDescuento.Font      = this.lb_subTotal.Font;
            this.txtDescuento.ReadOnly  = true;


            this.lb_iva.Name     = "lb_iva";
            this.lb_iva.Text     = "Iva ";
            this.lb_iva.Location = new Point(this.txtDescuento.Location.X + this.txtDescuento.Size.Width + separacionIF, margenIF);
            this.lb_iva.AutoSize = true;
            this.lb_iva.Font     = this.lb_subTotal.Font;

            this.lb_valorIva.Name      = "lb_valorIva";
            this.lb_valorIva.Text      = "0.00";
            this.lb_valorIva.Location  = new Point(this.lb_iva.Location.X + this.lb_iva.Size.Width, margenIF);
            this.lb_valorIva.AutoSize  = true;
            this.lb_valorIva.ForeColor = Color.DarkBlue;
            this.lb_valorIva.Font      = this.lb_subTotal.Font;


            this.lb_total.Name     = "lb_total";
            this.lb_total.Text     = "Total";
            this.lb_total.Location = new Point(this.lb_subTotal.Location.X + this.lb_subTotal.Size.Width + separacionIF, this.lb_subTotal.Location.Y + this.lb_subTotal.Size.Height + separacionIF);
            this.lb_total.AutoSize = true;
            this.lb_total.Font     = new Font(this.FuenteLeta.FontFamily, this.FuenteLeta.Size + 20f, FontStyle.Bold, this.FuenteLeta.Unit);

            this.lb_valorTotal.Name      = "lb_valorTotal";
            this.lb_valorTotal.Text      = "0.00";
            this.lb_valorTotal.Location  = new Point(this.lb_total.Location.X + this.lb_total.Size.Width, this.lb_total.Location.Y);
            this.lb_valorTotal.AutoSize  = true;
            this.lb_valorTotal.ForeColor = Color.DarkBlue;
            this.lb_valorTotal.Font      = this.lb_total.Font;

            this.lb_nombreEmpreado.Name      = "lb_nombreEmpreado";
            this.lb_nombreEmpreado.Text      = "";
            this.lb_nombreEmpreado.AutoSize  = true;
            this.lb_nombreEmpreado.ForeColor = Color.DarkSlateBlue;
            this.lb_nombreEmpreado.Font      = new Font(this.FuenteLeta.Name, tamañoLetraIF + 20f, FontStyle.Bold);
            this.lb_nombreEmpreado.Location  = new Point(this.lb_valorIva.Location.X + this.lb_valorIva.Size.Width + separacionIF, this.infoFactura.Size.Height / 2);

            this.bt_imprimir.Name      = "bt_imprimir";
            this.bt_imprimir.Text      = "Imprimir";
            this.bt_imprimir.Size      = new Size(150, (this.infoFactura.Size.Height - separacionIF) - separacionIF);
            this.bt_imprimir.Font      = new Font(this.FuenteLeta.Name, tamañoLetraIF + 10f, FontStyle.Bold);
            this.bt_imprimir.Location  = new Point((this.infoFactura.Size.Width - this.bt_imprimir.Size.Width) - separacionIF, separacionIF);
            this.bt_imprimir.BackColor = Color.White;
            #endregion


            #endregion
            //---------------------------------
        }