Exemplo n.º 1
0
        private void Procesar_Operacion()
        {
            ClsRecojo_Combustible_ImporteBE TipoBE = new ClsRecojo_Combustible_ImporteBE();

            TipoBE.Reco_ide               = ID_Reco_Ide;
            TipoBE.Reco_ide_detalle       = ID_Reco_Ide_Detalle;
            TipoBE.Prov_ide               = Convert.ToInt32(txtProv_Ide.Text);
            TipoBE.Reco_kilometro_inicial = Convert.ToInt32(txtKmInicial.Text);
            TipoBE.Reco_kilometro_final   = Convert.ToInt32(txtKmFinal.Text);
            TipoBE.Reco_importe           = Convert.ToDouble(txtImporte.Text);
            TipoBE.Reco_rendimiento       = Convert.ToDouble(txtRendimiento.Text);
            TipoBE.Veces   = ID_Veces;
            TipoBE.Usuario = "ADMIN";


            switch (Operacion_Combustible)
            {
            case "N":
                ENResultOperation R = ClsRecojo_Combustible_ImporteBC.Crear(TipoBE);
                break;

            case "M": ClsRecojo_Combustible_ImporteBC.Actualizar(TipoBE);
                break;

            case "E": ClsRecojo_Combustible_ImporteBC.Eliminar(TipoBE);
                break;
            }
            this.Close();
        }
Exemplo n.º 2
0
        private void frmRecojo_Combustible_Importe_Load(object sender, EventArgs e)
        {
            ToolTip toolTip1 = new ToolTip();

            // Set up the delays for the ToolTip.
            toolTip1.AutoPopDelay = 5000;
            toolTip1.InitialDelay = 1000;
            toolTip1.ReshowDelay  = 500;
            // Force the ToolTip text to be displayed whether or not the form is active.
            toolTip1.ShowAlways = true;

            // Set up the ToolTip text for the Button and Checkbox.
            toolTip1.SetToolTip(this.txtRuc, "F3 - Para Selecionar Proveedor");

            ENResultOperation R   = ClsRecojo_CabeceraBC.Obtener_Registro(ID_Reco_Ide);
            DataTable         dt  = (DataTable)R.Valor;
            DataRow           ROW = dt.Rows[0];

            ID_Veces = Convert.ToInt32(ROW["VECES"].ToString());
            lblTipoCombustible.Text = cTipoCombustible;

            if (Operacion_Combustible == "N")
            {
                txtIde_Detalle.Text = "0";
                txtProv_Ide.Text    = "";
                txtProv_Nombre.Text = "";
                txtKmInicial.Text   = "0";
                txtKmFinal.Text     = "0";
                txtImporte.Text     = "0";
                txtTotal.Text       = "0";
                txtRendimiento.Text = Veh_Rendimiento;
                nRendimiento        = Convert.ToDecimal(Veh_Rendimiento);
            }
            else
            {
                ENResultOperation C   = ClsRecojo_Combustible_ImporteBC.Obtener_Registro(ID_Reco_Ide, ID_Reco_Ide_Detalle);
                DataTable         dtc = (DataTable)C.Valor;
                if (dtc.Rows.Count != 0)
                {
                    DataRow ROWC = dtc.Rows[0];
                    txtIde_Detalle.Text = ROWC["RECO_IDE_DETALLE"].ToString();
                    txtProv_Ide.Text    = ROWC["PROV_IDE"].ToString();
                    txtProv_Nombre.Text = ROWC["PROV_NOMBRE"].ToString();

                    nKmInicial        = Convert.ToInt32(ROWC["RECO_KILOMETRO_INICIAL"].ToString());
                    txtKmInicial.Text = nKmInicial.ToString();

                    nKmFinal        = Convert.ToInt32(ROWC["RECO_KILOMETRO_FINAL"].ToString());
                    txtKmFinal.Text = nKmFinal.ToString();

                    nImporte        = Convert.ToDecimal(ROWC["RECO_IMPORTE"].ToString());
                    txtImporte.Text = nImporte.ToString();

                    nRendimiento        = Convert.ToDecimal(ROWC["RECO_RENDIMIENTO"].ToString());
                    txtRendimiento.Text = nRendimiento.ToString();

                    nRecorrido        = nKmFinal - nKmInicial;
                    txtRecorrido.Text = nRecorrido.ToString("### ###,###");

                    if (nRendimiento > 0)
                    {
                        nFactor = nRecorrido / nRendimiento;
                    }
                    else
                    {
                        nFactor = 0;
                    }
                    txtFactor.Text = nFactor.ToString("###,###.000");
                    nTotal         = nImporte * nFactor;
                    txtTotal.Text  = nTotal.ToString("###,###.00");

                    if (Operacion_Combustible == "E")
                    {
                        txtIde_Detalle.Enabled = false;
                        txtProv_Ide.Enabled    = false;
                        txtProv_Nombre.Enabled = false;
                        txtKmInicial.Enabled   = false;
                        txtKmFinal.Enabled     = false;
                        txtImporte.Enabled     = false;
                        txtRendimiento.Enabled = false;
                        btnGrabar.Text         = "Elimina";
                    }
                    if (Obtener_Proveedor())
                    {
                        txtKmInicial.Focus();
                    }
                }
            }
        }