private void FormadePagoID_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 13)
     {
         CodigoA.Focus();
     }
 }
 private void FechaExpiracion_ValueChanged(object sender, EventArgs e)
 {
     if (vArticulo == 0 && FechaExpiracion.Text == "01/01/0001")
     {
         Lote.Text = "";
         MessageBox.Show("Seleccione el articulo que decea agregar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         CodigoA.Focus();
     }
 }
 private void Lote_TextChanged(object sender, EventArgs e)
 {
     if (vArticulo == 0)
     {
         Lote.Text = "";
         MessageBox.Show("Seleccione el articulo que decea agregar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         CodigoA.Focus();
     }
 }
 private void Costo_TextChanged(object sender, EventArgs e)
 {
     if (vArticulo == 0 && Costo.Text != "0.00")
     {
         Lote.Text = "";
         MessageBox.Show("Seleccione el articulo que decea agregar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         CodigoA.Focus();
         return;
     }
     CalcularImporte();
 }
Example #5
0
        private void FillCliente(DataRow vRow)
        {
            Codigo.Text    = vRow["Codigo"].ToString();
            Nombre.Text    = vRow["Nombre"].ToString() + " " + vRow["Apellido"].ToString();
            Telefonos.Text = (vRow["Telefono"].ToString().Length > 6 ? "Tel:" + vRow["Telefono"].ToString() + " " : "") + (vRow["Celular"].ToString().Length > 6 ? "Cel:" + vRow["Celular"].ToString() : "");
            Direccion.Text = (vRow["Provincia"].ToString().Length > 2 ? vRow["Provincia"].ToString() + "," : "") +
                             (vRow["Ciudad"].ToString().Length > 2 ? vRow["Ciudad"].ToString() + "," : "") + vRow["Pais"].ToString();
            Cedula.Text        = vRow["Cedula"].ToString();
            Desc.Value         = vRow["Descuento"].ToString();
            Desc.Visible       = (Convert.ToDecimal(Desc.Value) == 0 ? false : true);
            radLabel28.Visible = (Convert.ToDecimal(Desc.Value) == 0 ? false : true);
            TipodeComprobanteID.SelectedValue = (C.Cint(vRow["TipoComprobanteID"].ToString()) == 0?2: C.Cint(vRow["TipoComprobanteID"].ToString()));

            CodigoA.Focus();
        }
Example #6
0
 private void NewFactura()
 {
     LimpiarArticulo();
     clearCliente();
     Fecha.Value    = DateTime.Today;
     dtFactura      = C.SQL("FACTURA_L 0");
     dtDetallepago  = C.SQL("COBRAR_FACTURA_L 0");
     GRD.DataSource = dtFactura;
     vFacturaID     = 0;
     vOpt           = 0;
     Calcular();
     Codigo.Text = "1";
     BuscarCliente();
     CodigoA.Focus();
 }
Example #7
0
 private void bCancelar_Click(object sender, EventArgs e)
 {
     if (GRD.RowCount > 0)
     {
         if (MessageBox.Show("Deseas Cancelar la Factura?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             NewFactura();
         }
         else
         {
             CodigoA.Focus();
         }
     }
     else
     {
         NewFactura();
     }
 }
Example #8
0
        private void bAddArticulo_Click(object sender, EventArgs e)
        {
            if (vClienteID == 0 || Codigo.Text.Length == 0)
            {
                MessageBox.Show("Debes indicar el Cliente antes de iniciar a Facturar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Codigo.Focus();
                return;
            }

            if (vArticuloID == 0 || Descripcion.Text.Length == 0)
            {
                MessageBox.Show("Indique que articulo desea Facturar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CodigoA.Focus();
                return;
            }

            if (Cantidad.Text == "0")
            {
                MessageBox.Show("Indique la Cantidad de Articulos que decea Facturar ", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Cantidad.Focus();
                return;
            }

            if (Convert.ToDecimal(Existencia.Text) < Convert.ToDecimal(Cantidad.Value.ToString()))
            {
                MessageBox.Show((Convert.ToDecimal(Existencia.Text) == 0 ? "Este Articulo no Tiene existencia Para facturar" : "La Cantidad de Articulos que deseas Facturar es mayor a la disponible en su inventario"),
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Cantidad.Focus();
                return;
            }

            dtFactura.PrimaryKey = new DataColumn[] { dtFactura.Columns["ArticuloID"] };

            DataRow vRowActual = dtFactura.Rows.Find(vArticuloID);

            if (vRowActual == null)
            {
                dtFactura.PrimaryKey = new DataColumn[] { dtFactura.Columns["FacturaDetalleID"] };
                decimal importes     = (Convert.ToDecimal(Precio.Text) * Convert.ToDecimal(Cantidad.Text));
                decimal Itbisamount  = (Convert.ToDecimal(Precio.Text) * Convert.ToDecimal(dtArticulos.Rows[0]["ITBISPorciento"].ToString()));
                decimal precioActual = Convert.ToDecimal(Precio.Text) - (Convert.ToDecimal(Precio.Text) * Convert.ToDecimal(dtArticulos.Rows[0]["ITBISPorciento"].ToString()));

                DataRow vRow = dtFactura.NewRow();
                vRow["Edit"]             = 0;
                vRow["FacturaDetalleID"] = Contador;
                vRow["Descripcion"]      = Descripcion.Text;
                vRow["Codigo"]           = CodigoA.Text;
                vRow["ArticuloID"]       = vArticuloID;
                vRow["PrecioActual"]     = precioActual;
                vRow["ArticuloPrecioID"] = dtArticulos.Rows[0]["PrecioActualId"].ToString();
                vRow["UnidadMedida"]     = Unidad.Text;
                vRow["Cantidad"]         = Cantidad.Value;
                vRow["ItbisID"]          = dtArticulos.Rows[0]["ItbisID"].ToString();
                vRow["Importe"]          = importes - (Convert.ToDecimal(descuento.Value));
                vRow["Descuento"]        = Convert.ToDecimal(descuento.Value);
                vRow["ITBISAMOUNT"]      = Itbisamount;

                Contador++;
                dtFactura.Rows.Add(vRow);
            }
            else
            {
                if (Convert.ToDecimal(Existencia.Text) - Convert.ToDecimal(vRowActual["Cantidad"].ToString()) < Convert.ToDecimal(Cantidad.Value.ToString()))
                {
                    MessageBox.Show((Convert.ToDecimal(Existencia.Text) == 0 ? "No hay articulos Disponibles para Facturar" : "La Cantidad de Articulos que deseas Facturar es mayor a la disponible en su inventario"),
                                    Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                vRowActual["Cantidad"] = Convert.ToInt32(vRowActual["Cantidad"].ToString()) + Convert.ToInt32(Cantidad.Value);
                decimal importes = (Convert.ToDecimal(Precio.Text) * Convert.ToDecimal(vRowActual["Cantidad"].ToString()));
                vRowActual["Importe"] = importes - (importes * Convert.ToDecimal(descuento.Value));
            }

            Calcular();
            LimpiarArticulo();
            CodigoA.Focus();
        }
Example #9
0
        private void bAddArticulo_Click(object sender, EventArgs e)
        {
            if (vArticulo == 0 || Descripcion.Text.Length == 0)
            {
                MessageBox.Show("Indique que articulo desea agregar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CodigoA.Focus();
                return;
            }

            if (Costo.Text == "0.00")
            {
                MessageBox.Show("Indique el Costo del Articulo ", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Costo.Focus();
                return;
            }

            if (Cantidad.Text == "0")
            {
                MessageBox.Show("Indique la Cantidad de Articulos que decea agregar ", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Cantidad.Focus();
                return;
            }


            if (vedit == 0)
            {
                dtIngreso.PrimaryKey = new DataColumn[] { dtIngreso.Columns["ArticuloID"] };

                DataRow vRowActual = dtIngreso.Rows.Find(vArticulo);

                if (vRowActual == null)
                {
                    dtIngreso.PrimaryKey = new DataColumn[] { dtIngreso.Columns["ORDENCOMPRASDETALLEID"] };
                    decimal importes = (Convert.ToDecimal(Costo.Text) * Convert.ToDecimal(Cantidad.Text));
                    DataRow vRow     = dtIngreso.NewRow();
                    vRow["Edit"]                  = 0;
                    vRow["OrdenCompraID"]         = 0;
                    vRow["ProveedorID"]           = vProveedorID;
                    vRow["ORDENCOMPRASDETALLEID"] = Contador;
                    vRow["Descripcion"]           = Descripcion.Text;
                    vRow["Codigo"]                = CodigoA.Text;
                    vRow["ArticuloID"]            = vArticulo;
                    vRow["Costo"]                 = Costo.Value;
                    vRow["Lote"]                  = Lote.Text;
                    vRow["UnidadMedida"]          = Unidad.Text;
                    vRow["FechaExpiracion"]       = FechaExpiracion.Value.Date;
                    vRow["Cantidad"]              = Cantidad.Value;
                    vRow["Importe"]               = importes;
                    vRow["ITBIS"]                 = Itbis;
                    vRow["ItbisPorciento"]        = ItbisPorciento;

                    Contador++;
                    dtIngreso.Rows.Add(vRow);
                }
                else
                {
                    if (vRowActual["Costo"].ToString() != Costo.Value.ToString() || vRowActual["Lote"].ToString() != Lote.Text || vRowActual["FechaExpiracion"].ToString() != FechaExpiracion.Value.Date.ToString())
                    {
                        dtIngreso.PrimaryKey = new DataColumn[] { dtIngreso.Columns["ORDENCOMPRASDETALLEID"] };
                        decimal importes = (Convert.ToDecimal(Costo.Text) * Convert.ToDecimal(Cantidad.Text));
                        DataRow vRow     = dtIngreso.NewRow();
                        vRow["Edit"]                  = 0;
                        vRow["OrdenCompraID"]         = 0;
                        vRow["ProveedorID"]           = vProveedorID;
                        vRow["ORDENCOMPRASDETALLEID"] = Contador;
                        vRow["Descripcion"]           = Descripcion.Text;
                        vRow["Codigo"]                = CodigoA.Text;
                        vRow["ArticuloID"]            = vArticulo;
                        vRow["Costo"]                 = Costo.Value;
                        vRow["Lote"]                  = Lote.Text;
                        vRow["UnidadMedida"]          = Unidad.Text;
                        vRow["FechaExpiracion"]       = (FechaExpiracion.Value);
                        vRow["Cantidad"]              = Cantidad.Value;
                        vRow["Importe"]               = importes;
                        vRow["ITBIS"]                 = Itbis;
                        vRow["ItbisPorciento"]        = ItbisPorciento;

                        Contador++;
                        dtIngreso.Rows.Add(vRow);
                    }
                    else
                    {
                        vRowActual["Edit"]     = (vRowActual["Edit"].ToString() == "-1" ? 1 : 0);
                        vRowActual["Cantidad"] = int.Parse(vRowActual["Cantidad"].ToString()) + int.Parse(Cantidad.Value.ToString());
                        decimal importes = Convert.ToDecimal(vRowActual["Costo"].ToString()) * int.Parse(vRowActual["Cantidad"].ToString());
                        vRowActual["Importe"] = importes;
                    }
                }
            }
            else
            {
                dtIngreso.PrimaryKey = new DataColumn[] { dtIngreso.Columns["ORDENCOMPRASDETALLEID"] };
                DataRow vRow = dtIngreso.Rows.Find(vORDENCOMPRASDETALLEID);
                if (vRow != null)
                {
                    decimal importes = (Convert.ToDecimal(Costo.Text) * Convert.ToDecimal(Cantidad.Text));
                    vRow["EDIT"]            = 1;
                    vRow["Lote"]            = Lote.Text;
                    vRow["FechaExpiracion"] = (FechaExpiracion.Value.Date.Year < 2010?"1/1/3000": FechaExpiracion.Value.Date.ToString());
                    vRow["Costo"]           = Costo.Value;
                    vRow["Cantidad"]        = Cantidad.Value;
                    vRow["Importe"]         = importes;
                }
            }

            GRD.DataSource = dtIngreso;
            LimpiarArticulo();
            Calcular();
            vedit = 0;
            CodigoA.Focus();
        }