コード例 #1
0
        private void txt_CodigoBarra_TextChanged(object sender, EventArgs e)
        {
            int       b           = 0;
            string    CodigoBarra = txt_CodigoBarra.Text;
            cInsumo   insumo      = new cInsumo();
            DataTable trdoIn      = insumo.GetInsumoxCodigoBarra(CodigoBarra);

            if (trdoIn.Rows.Count > 0)
            {
                if (trdoIn.Rows[0]["CodInsumo"].ToString() != "")
                {
                    b = 1;
                    Int32 CodInsumo = Convert.ToInt32(trdoIn.Rows[0]["CodInsumo"].ToString());
                    txt_Cantidad.Text = trdoIn.Rows[0]["Cantidad"].ToString();
                    //cInsumo insumo = new cInsumo();
                    DataTable trdo = insumo.GetInsumoxCodigo(CodInsumo);
                    if (trdo.Rows.Count > 0)
                    {
                        txtCodigo.Text  = CodInsumo.ToString();
                        txt_Nombre.Text = trdo.Rows[0]["Nombre"].ToString();
                        txt_Precio.Text = trdo.Rows[0]["Precio"].ToString();
                        if (trdo.Rows[0]["ActualizaStock"].ToString() == "1")
                        {
                            chk_ActualizaStock.Checked = true;
                        }
                        else
                        {
                            chk_ActualizaStock.Checked = false;
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: FrmVenta.cs プロジェクト: pablomartinzabala2/Taller
        private void form_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (frmPrincipal.CodigoPrincipal != null)
            {
                Int32     CodInsumo = Convert.ToInt32(frmPrincipal.CodigoPrincipal);
                cInsumo   insumo    = new cInsumo();
                DataTable trdo      = insumo.GetInsumoxCodigo(CodInsumo);
                if (trdo.Rows.Count > 0)
                {
                    txtCodigo.Text   = trdo.Rows[0]["CodInsumo"].ToString();
                    txtCantidad.Text = trdo.Rows[0]["Cantidad"].ToString();
                    txt_Precio.Text  = trdo.Rows[0]["Precio"].ToString();
                    txt_Nombre.Text  = trdo.Rows[0]["Nombre"].ToString();
                    if (txtCantidad.Text == "")
                    {
                        txtCantidad.Text = "0";
                    }

                    if (txt_Precio.Text != "")
                    {
                        txt_Precio.Text = fun.SepararDecimales(txt_Precio.Text);
                        txt_Precio.Text = fun.FormatoEnteroMiles(txt_Precio.Text);
                    }
                    AplicarPorcentaje();
                }
            }
        }
コード例 #3
0
        private void Buscar()
        {
            cMovimiento mov      = new cMovimiento();
            double      Efectivo = mov.GetTotalEfectivo();

            txtEfectivo.Text = Efectivo.ToString();
            txtEfectivo.Text = fun.SepararDecimales(txtEfectivo.Text);
            txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text);
            cDocumento doc        = new cDocumento();
            double     ImporteDoc = doc.GetTotalDocumentos();

            txtDocumentos.Text = ImporteDoc.ToString();
            txtDocumentos.Text = fun.SepararDecimales(txtDocumentos.Text);
            txtDocumentos.Text = fun.FormatoEnteroMiles(txtDocumentos.Text);
            cCobroTarjeta cobro = new cCobroTarjeta();

            txtTotalTarjeta.Text = cobro.GetTotal().ToString();
            txtTotalTarjeta.Text = fun.SepararDecimales(txtTotalTarjeta.Text);
            txtTotalTarjeta.Text = fun.FormatoEnteroMiles(txtTotalTarjeta.Text);
            cCheque cheque = new cCheque();

            txtTotalCheque.Text = cheque.GetTotalCheque().ToString();
            txtTotalCheque.Text = fun.SepararDecimales(txtTotalCheque.Text);
            txtTotalCheque.Text = fun.FormatoEnteroMiles(txtTotalCheque.Text);

            cGarantia garantia = new cGarantia();

            txtGarantia.Text = garantia.GetTotalGarantia().ToString();
            txtGarantia.Text = fun.SepararDecimales(txtGarantia.Text);
            txtGarantia.Text = fun.FormatoEnteroMiles(txtGarantia.Text);

            cInsumo insumo = new cInsumo();

            txtTotalInsumo.Text = insumo.GetTotalInsumo().ToString();
            txtTotalInsumo.Text = fun.SepararDecimales(txtTotalInsumo.Text);
            txtTotalInsumo.Text = fun.FormatoEnteroMiles(txtTotalInsumo.Text);

            cVale vale = new cVale();

            txtTotalVale.Text = vale.GetTotalVales().ToString();
            txtTotalVale.Text = fun.SepararDecimales(txtTotalVale.Text);
            txtTotalVale.Text = fun.FormatoEnteroMiles(txtTotalVale.Text);

            cTransferencia tra = new Clases.cTransferencia();

            txtTotalTransferencia.Text = tra.GetTotal().ToString();
            txtTotalTransferencia.Text = fun.SepararDecimales(txtTotalTransferencia.Text);
            txtTotalTransferencia.Text = fun.FormatoEnteroMiles(txtTotalTransferencia.Text);

            cCuentaCorriente cuenta        = new cCuentaCorriente();
            Double           ImporteCuenta = cuenta.GetTotal();

            txtCuentaCorriente.Text = ImporteCuenta.ToString();
            txtCuentaCorriente.Text = fun.SepararDecimales(txtCuentaCorriente.Text);
            txtCuentaCorriente.Text = fun.FormatoEnteroMiles(txtCuentaCorriente.Text);
        }
コード例 #4
0
        private void btnBuscarOrden_Click(object sender, EventArgs e)
        {
            cInsumo   insumo = new cInsumo();
            DataTable trdo   = insumo.GetInsumosxNombre(txtInsumo.Text);

            trdo = fun.TablaaMiles(trdo, "Precio");
            Grilla.DataSource         = trdo;
            Grilla.Columns[0].Visible = false;
            Grilla.Columns[1].Width   = 400;
            Grilla.Columns[2].Width   = 100;
            Grilla.Columns[3].Width   = 100;
        }
コード例 #5
0
ファイル: FrmVenta.cs プロジェクト: pablomartinzabala2/Taller
        private void txtCodigoBarra_TextChanged(object sender, EventArgs e)
        {
            int       b           = 0;
            string    CodigoBarra = txtCodigoBarra.Text;
            cInsumo   insumo      = new cInsumo();
            DataTable trdoIn      = insumo.GetInsumoxCodigoBarra(CodigoBarra);

            if (trdoIn.Rows.Count > 0)
            {
                if (trdoIn.Rows[0]["CodInsumo"].ToString() != "")
                {
                    b = 1;
                    Int32 CodInsumo = Convert.ToInt32(trdoIn.Rows[0]["CodInsumo"].ToString());
                    //cInsumo insumo = new cInsumo();
                    DataTable trdo = insumo.GetInsumoxCodigo(CodInsumo);
                    if (trdo.Rows.Count > 0)
                    {
                        txtCodigo.Text   = trdo.Rows[0]["CodInsumo"].ToString();
                        txtCantidad.Text = trdo.Rows[0]["Cantidad"].ToString();
                        txt_Precio.Text  = trdo.Rows[0]["Precio"].ToString();
                        txt_Nombre.Text  = trdo.Rows[0]["Nombre"].ToString();
                        if (txtCantidad.Text == "")
                        {
                            txtCantidad.Text = "0";
                        }

                        if (txt_Precio.Text != "")
                        {
                            txt_Precio.Text = fun.SepararDecimales(txt_Precio.Text);
                            txt_Precio.Text = fun.FormatoEnteroMiles(txt_Precio.Text);
                        }
                        AplicarPorcentaje();
                    }
                }
            }
            if (b == 0)
            {
                txtCodigo.Text   = "";
                txtCantidad.Text = "";
                txt_Precio.Text  = "";
                txt_Nombre.Text  = "";
            }
        }
コード例 #6
0
        private void BuscarInsumoxCodigo(Int32 CodInsumo)
        {
            cInsumo   insumo = new cInsumo();
            DataTable trdo   = insumo.GetInsumoxCodigo(CodInsumo);

            if (trdo.Rows.Count > 0)
            {
                txtCodigo.Text   = trdo.Rows[0]["CodInsumo"].ToString();
                txtCantidad.Text = trdo.Rows[0]["Cantidad"].ToString();
                txt_Precio.Text  = trdo.Rows[0]["Precio"].ToString();
                txt_Nombre.Text  = trdo.Rows[0]["Nombre"].ToString();
                if (txtCantidad.Text == "")
                {
                    txtCantidad.Text = "0";
                }

                if (txt_Precio.Text != "")
                {
                    txt_Precio.Text = fun.SepararDecimales(txt_Precio.Text);
                    txt_Precio.Text = fun.FormatoEnteroMiles(txt_Precio.Text);
                }
            }
        }
コード例 #7
0
        private void BuscarInsumoxCodBarra(string CodigoBarra)
        {
            cInsumo   insumo = new cInsumo();
            DataTable trdo   = insumo.GetInsumoxCodigoBarra(CodigoBarra);
            int       b      = 0;

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodInsumo"].ToString() != "")
                {
                    b = 1;
                    Int32 CodInsumo = Convert.ToInt32(trdo.Rows[0]["CodInsumo"].ToString());
                    BuscarInsumoxCodigo(CodInsumo);
                }
            }
            if (b == 0)
            {
                txtCodigo.Text      = "";
                txtCantidad.Text    = "";
                txt_Precio.Text     = "";
                txt_Nombre.Text     = "";
                txtPrecioVenta.Text = "";
            }
        }
コード例 #8
0
ファイル: FrmVenta.cs プロジェクト: pablomartinzabala2/Taller
        private void btnGrabarVenta_Click(object sender, EventArgs e)
        {
            if (fun.ValidarFecha(txtFechaAltaOrden.Text) == false)
            {
                Mensaje("La fecha ingresada es incorrecta");
                return;
            }
            if (tbVenta.Rows.Count == 0)
            {
                Mensaje("Debe ingresar al menos un producto para vender");
                return;
            }

            if (txtApellido.Text == "")
            {
                Mensaje("Debe ingresar un apellido");
                return;
            }
            if (txtNombre.Text == "")
            {
                Mensaje("Debe ingresar un nombre");
                return;
            }

            if (ValidarImportes() == false)
            {
                Mensaje("La forma de pago no coincide con el total a pagar");
                return;
            }
            SqlConnection con    = new SqlConnection(cConexion.Cadenacon());
            Double        Total  = 0;
            cInsumo       insumo = new cInsumo();
            DateTime      Fecha  = DateTime.Now;

            if (txtTotal.Text != "")
            {
                Total = fun.ToDouble(txtTotal.Text);
            }
            Fecha = Convert.ToDateTime(txtFechaAltaOrden.Text);
            Double Efectivo = 0;

            if (txtEfectivo.Text != "")
            {
                Efectivo = fun.ToDouble(txtEfectivo.Text);
            }
            cVenta venta      = new cVenta();
            Int32  CodVenta   = 0;
            Int32  CodInsumo  = 0;
            Int32  Cantidad   = 0;
            Double Precio     = 0;
            Double Subtotal   = 0;
            Double Costo      = 0;
            Int32? CodCliente = null;

            con.Open();
            SqlTransaction tranOrden;

            tranOrden = con.BeginTransaction("TranOrden");
            try
            {
                if (txtApellido.Text != "" && txtNombre.Text != "")
                {
                    CodCliente = GrabarCliente(con, tranOrden);
                }

                CodVenta = venta.InsertarVenta(con, tranOrden, Fecha, Total, CodCliente, Efectivo);
                for (int i = 0; i < tbVenta.Rows.Count; i++)
                {
                    if (tbVenta.Rows[i]["CodInsumo"].ToString() != "")
                    {
                        CodInsumo = Convert.ToInt32(tbVenta.Rows[i]["CodInsumo"].ToString());
                        Cantidad  = Convert.ToInt32(tbVenta.Rows[i]["Cantidad"].ToString());
                        Precio    = fun.ToDouble(tbVenta.Rows[i]["Precio"].ToString());
                        Subtotal  = fun.ToDouble(tbVenta.Rows[i]["Subtotal"].ToString());
                        Costo     = fun.ToDouble(tbVenta.Rows[i]["Costo"].ToString());
                        venta.InsertarDetalleVenta(con, tranOrden, CodVenta, CodInsumo, Cantidad, Precio, Subtotal, Costo);
                        GrabarFormaPago(con, tranOrden, null, CodVenta);
                        insumo.ActualizarStock(con, tranOrden, CodInsumo, (-1) * Cantidad);
                    }
                }
                tranOrden.Commit();
                con.Close();
                Mensaje("Datos grabados correctamente");
                Limpiar();
            }
            catch (Exception ex)
            {
                tranOrden.Rollback();
                con.Close();
                Mensaje("Hubo un error en el proceso de grabación");
            }
        }
コード例 #9
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                Mensaje("La fecha ingresada es incorrecta");
                return;
            }
            if (Grilla.Rows.Count < 1)
            {
                Mensaje("Debe ingresar insumos para continuar");
                return;
            }
            SqlConnection con = new SqlConnection();

            con.ConnectionString = Clases.cConexion.Cadenacon();
            con.Open();
            SqlTransaction Transaccion;

            Transaccion = con.BeginTransaction();
            Int32  CodCompra    = 0;
            Double PrecioVenta  = 0;
            Int32? CodProveedor = null;

            if (CmbProveedor.SelectedIndex > 0)
            {
                CodProveedor = Convert.ToInt32(CmbProveedor.SelectedValue);
            }
            DateTime       Fecha       = Convert.ToDateTime(txtFecha.Text);
            cCompra        objCompra   = new cCompra();
            cDetalleCompra objDetalle  = new cDetalleCompra();
            cMovimiento    mov         = new cMovimiento();
            string         Descripcion = "";

            try
            {
                cInsumo insumo = new cInsumo();
                CodCompra = objCompra.InsertarCompra(con, Transaccion, Fecha, CodProveedor, txtFactura.Text);
                for (int i = 0; i < Grilla.Rows.Count - 1; i++)
                {
                    Int32  CodInsumo = Convert.ToInt32(Grilla.Rows[i].Cells[0].Value.ToString());
                    string Insumo    = Grilla.Rows[i].Cells[1].Value.ToString();
                    Int32  Cantidad  = Convert.ToInt32(Grilla.Rows[i].Cells[2].Value.ToString());
                    double Precio    = Convert.ToDouble(Grilla.Rows[i].Cells[4].Value.ToString().Replace(",", "."));
                    double Total     = Cantidad * Precio;
                    Descripcion = "COMPRA REPUESTO " + Insumo.ToString();
                    Descripcion = Descripcion + ", CANTIDAD " + Cantidad.ToString();
                    if (Grilla.Rows[i].Cells["PrecioVenta"].ToString() != "")
                    {
                        PrecioVenta = fun.ToDouble(Grilla.Rows[i].Cells["PrecioVenta"].Value.ToString());
                    }
                    mov.GrabarMovimientoTransaccion(con, Transaccion, -1 * Total, Descripcion, Fecha, 1, null);
                    objDetalle.InsertarDetalle(con, Transaccion, CodCompra, CodInsumo, Cantidad, Precio);
                    insumo.ActualizarStock(con, Transaccion, CodInsumo, Cantidad);
                    insumo.ActualizarPrecio(con, Transaccion, CodInsumo, Precio, PrecioVenta);
                }
                Transaccion.Commit();
                con.Close();
                Mensaje("Datos grabados correctamente");
                Limpiar();
            }
            catch (Exception ex)
            {
                Transaccion.Rollback();
                con.Close();
                MessageBox.Show("Hubo un error en el proceso de grabación", Clases.cMensaje.Mensaje());
            }
        }