コード例 #1
0
        /*MODULO CALCULO IVA*/
        private decimal calcularIva()
        {
            modSesion modSesion = new modSesion();
            var       montoIva  = default(decimal);
            decimal   valor;
            int       iva;

            iva   = Convert.ToInt32(productoAComprar.Tables["rsProducto"].Rows[0]["iva"]);
            valor = Convert.ToInt32(modSesion.convertirDecimal(txtCantidad.Text) * modSesion.convertirDecimal(txtCosto.Text));
            if (iva == 0)
            {
                montoIva = 0;
                vIva0    = vIva0 + valor; // acumulando total iva exenta
            }
            else if (iva == 5)
            {
                montoIva = valor / 21;       // calculando importe iva incluido 5%
                vIva5    = vIva5 + montoIva; // acumulando total iva 5%
            }
            else if (iva == 10)
            {
                montoIva = valor / 11; // calculadon importe iva incluido 10%
                vIva10   = vIva10 + montoIva;
            }

            vTotalIVa        = vIva5 + vIva10; // sumando total iva solo 5 y 10%
            txtIva0.Text     = Convert.ToString(modSesion.mascaraCosto(vIva0));
            txtIva5.Text     = Convert.ToString(modSesion.mascaraCosto(vIva5));
            txtIva10.Text    = Convert.ToString(modSesion.mascaraCosto(vIva10));
            txtTotalIva.Text = Convert.ToString(modSesion.mascaraCosto(vTotalIVa));
            return(montoIva);
        }
コード例 #2
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            FrmMenuCompra frmCompra = (FrmMenuCompra)Owner;
            modSesion     modSesion = new modSesion();

            frmCompra.lblCodigo.Text         = Convert.ToString(grilla[0, grilla.CurrentRow.Index].Value);
            frmCompra.lblDescricion.Text     = Convert.ToString(grilla[2, grilla.CurrentRow.Index].Value);
            frmCompra.txtCosto.Text          = Convert.ToString(modSesion.mascaraCosto(grilla[3, grilla.CurrentRow.Index].Value));
            frmCompra.txtCostoMedio.Text     = Convert.ToString(modSesion.mascaraCosto(grilla[4, grilla.CurrentRow.Index].Value));
            frmCompra.txtCostoReal.Text      = Convert.ToString(modSesion.mascaraCosto(grilla[3, grilla.CurrentRow.Index].Value));
            frmCompra.txtStock.Text          = Convert.ToString(modSesion.mascaraCantidad(grilla[5, grilla.CurrentRow.Index].Value));
            frmCompra.txtCodigoProducto.Text = Convert.ToString(grilla[0, grilla.CurrentRow.Index].Value);

            this.Close();
        }
コード例 #3
0
        private void cargarItem()
        {
            modSesion modSesion = new modSesion();
            int       n;
            decimal   subtotalProducto;

            grilla.Rows.Add();
            n = grilla.Rows.Count - 1;
            grilla[0, n].Value = n + 1;                                                                                                                    // items
            grilla[1, n].Value = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["id"]);                                                    // codigo
            grilla[2, n].Value = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["Descripcion"]);                                           // descripcion
            grilla[3, n].Value = txtCantidad.Text;                                                                                                         // cantidad
            grilla[4, n].Value = Convert.ToString(modSesion.mascaraCosto(txtCosto.Text));                                                                  // costo
            subtotalProducto   = Convert.ToDecimal(modSesion.convertirDecimal(txtCantidad.Text) * modSesion.convertirDecimal(txtCosto.Text));              // calculando subtotal del producto
            grilla[5, n].Value = Convert.ToString(modSesion.mascaraCosto(subtotalProducto));                                                               // subttotal
            grilla[6, n].Value = Convert.ToString(modSesion.mascaraCosto(calcularCostoMedio()));                                                           // costo medio
            grilla[7, n].Value = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["Iva"]);                                                   // iva
            grilla[8, n].Value = Convert.ToString(modSesion.mascaraCosto(calcularIva()));                                                                  // calcula monto iva incluido
            vTotalNeto         = Convert.ToDecimal(vTotalNeto + modSesion.convertirDecimal(txtCantidad.Text) * modSesion.convertirDecimal(txtCosto.Text)); // calcula total neto
            vSubtotal          = Convert.ToDecimal(vTotalNeto - vTotalIVa);                                                                                // calcula subtotal que es total neto menos iva incluido
            txtTotalNeto.Text  = Convert.ToString(modSesion.mascaraCosto(vTotalNeto));
            txtSubtotal.Text   = Convert.ToString(modSesion.mascaraCosto(vSubtotal));
            limpiarItems();
            txtCodigoProducto.Focus();
        }
コード例 #4
0
        public void buscarProducto()
        {
            modProducto modProducto = new modProducto();

            productoAComprar = new DataSet();
            string condicion = "";

            if (IsNumeric(txtCodigoProducto.Text) == true)
            {
                condicion = " where id = " + txtCodigoProducto.Text + " or CodigoDeBarra = '" + txtCodigoProducto.Text + "'";
            }
            else
            {
                condicion = " where  CodigoDeBarra = '" + txtCodigoProducto.Text + "'";
            }

            productoAComprar = modProducto.cargarProducto(condicion);
            if (Convert.ToInt32(productoAComprar.Tables["rsProducto"].Rows.Count) == 0)
            {
                Interaction.MsgBox("Producto No existente");
                txtCodigoProducto.Focus();
            }
            else
            {
                modSesion          = new modSesion();
                lblCodigo.Text     = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["id"]);
                lblDescricion.Text = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["Descripcion"]);
                string costomedio;
                costomedio         = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["CostoMedio"]);
                txtCosto.Text      = Convert.ToString(modSesion.mascaraCosto(costomedio));
                txtCostoMedio.Text = Convert.ToString(modSesion.mascaraCosto(productoAComprar.Tables["rsProducto"].Rows[0]["CostoMedio"]));
                txtCostoReal.Text  = Convert.ToString(modSesion.mascaraCosto(productoAComprar.Tables["rsProducto"].Rows[0]["Costo"]));
                txtStock.Text      = Convert.ToString(modSesion.mascaraCantidad(productoAComprar.Tables["rsProducto"].Rows[0]["Stock"]));
                txtCantidad.Focus();
            }
        }
コード例 #5
0
        /*MODULO PARA INICIAR LA COMPRA*/
        public void iniciarCompra()
        {
            // verificar compras para generar nuevo o capturar en caso de existir compra pendiente
            DataSet      regCompra    = new DataSet(); // almacena los registros
            DataSet      regProveedor = new DataSet();
            modCompra    modcompra    = new modCompra();
            modProveedor modProveedor = new modProveedor();
            modSesion    modSesion    = new modSesion();

            if (modcompra.verificarCompraPendiente() == "no")
            {
                if (modcompra.generarNuevaCompra() == true)
                {
                    regCompra = modcompra.capturarCompraPendiente();
                }
            }
            else if (modcompra.verificarCompraPendiente() == "si")
            {
                regCompra = modcompra.capturarCompraPendiente();
            }


            // se recorrera resultado de la tabla compra
            if (Convert.ToInt32(regCompra.Tables["rsCompra"].Rows.Count) > 0)
            {
                txtCompraID.Text    = Convert.ToString(regCompra.Tables["rsCompra"].Rows[0]["Id"]);
                txtIdProveedor.Text = Convert.ToString(regCompra.Tables["rsCompra"].Rows[0]["Id_Proveedor"]).PadLeft(3, '0');
                regProveedor        = modProveedor.cargarProveedor(txtIdProveedor.Text); // busca datos del proveedor seleccionado
                if (Convert.ToInt32(regProveedor.Tables["rsProveedor"].Rows.Count) > 0)
                {
                    txtNombreProveedor.Text = Convert.ToString(regProveedor.Tables["rsProveedor"].Rows[0]["RazonSocial"]);
                }
                else
                {
                    txtNombreProveedor.Text = "";
                }

                txtFactura.Text = Convert.ToString(regCompra.Tables["rsCompra"].Rows[0]["FacturaNro"]);
                string TipoDeCompra = (Convert.ToString(regCompra.Tables["rsCompra"].Rows[0]["TipoDeCompra"]));

                txtSubtotal.Text = Convert.ToString(modSesion.mascaraCosto(regCompra.Tables["rsCompra"].Rows[0]["subtotal"]));
                txtIva0.Text     = Convert.ToString(modSesion.mascaraCosto(regCompra.Tables["rsCompra"].Rows[0]["Iva0"]));
                txtIva5.Text     = Convert.ToString(modSesion.mascaraCosto(regCompra.Tables["rsCompra"].Rows[0]["Iva5"]));
                txtIva10.Text    = Convert.ToString(modSesion.mascaraCosto(regCompra.Tables["rsCompra"].Rows[0]["Iva10"]));
                // total iva calculo
                decimal totalIva;
                decimal a, b;
                a                 = Convert.ToDecimal(regCompra.Tables["rsCompra"].Rows[0]["Iva5"]);
                b                 = Convert.ToDecimal(regCompra.Tables["rsCompra"].Rows[0]["Iva10"]);
                totalIva          = a + b;
                txtTotalIva.Text  = Convert.ToString(modSesion.mascaraCosto(totalIva));
                txtTotalNeto.Text = Convert.ToString(modSesion.mascaraCosto(regCompra.Tables["rsCompra"].Rows[0]["TotalNeto"]));
                cbxfecha.Value    = Convert.ToDateTime(regCompra.Tables["rsCompra"].Rows[0]["FechaDeCompra"]);
            }
        }