Ejemplo n.º 1
0
        private void cmbCondl_TextChanged(object sender, EventArgs e)
        {
            if (cmbCondl.SelectedIndex > -1)
            {
                EN.itemList id = (EN.itemList)cmbCondl.SelectedItem;

                var query = produccionController.produccionxTaxista(id.value, dateTimePicker1.Value, dateTimePicker2.Value);

                if (query != null && query.producido != 0)
                {
                    txtDiasLiquidacion.Text      = query.dias.ToString();
                    txtIni.Text                  = query.inicio.Date.ToString();
                    txtfin.Text                  = query.final.Date.ToString();
                    txtTotalLiquidacion.Text     = query.producido.ToString() + " $";
                    txtPlaca.Text                = query.placa.ToString();
                    txtIni.ReadOnly              = true;
                    txtfin.ReadOnly              = true;
                    txtTotalLiquidacion.ReadOnly = true;
                    txtPlaca.ReadOnly            = true;
                }
                else
                {
                    MessageBox.Show("Intente de nuevo y verifique que el conductor tenga producidos en este rango de fecha");
                }
            }
        }
Ejemplo n.º 2
0
 private void dgvProducciones_DoubleClick(object sender, EventArgs e)
 {
     if (dgvProducciones.CurrentRow.Index != -1)
     {
         EN.Produccion other     = produccionController.ObtenerProduccionPorId(Convert.ToInt32(dgvProducciones.CurrentRow.Cells["id"].Value));
         EN.Taxis      txs       = taxisController.GetTaxi(other.placa);
         BR.Conductor  conductor = conductoresController.MostarConductorxNombre(other.conductor);
         EN.itemList   item      = new EN.itemList(conductor.id, conductor.nombre.ToUpper() + " " + conductor.apellido.ToUpper());
         int           index     = cmbConductor.FindString(item.descipcion);
         cmbConductor.SelectedIndex = index;
         //Pintar los datos
         cmbTx.Text      = txs.placa.Trim().ToUpper() + " " + txs.marca;
         dtpInicio.Value = other.inicio;
         dtpFinal.Value  = other.final;
         double pdia = other.producido / other.dias;
         txtLiquidaciondia.Text     = pdia.ToString();
         txtTotal.Text              = other.producido.ToString();
         txtTotal.ReadOnly          = true;
         txtDiasTrabajados.Text     = other.dias.ToString();
         txtDiasTrabajados.ReadOnly = true;
     }
     else
     {
         MessageBox.Show("Seleccione un registro");
     }
 }
Ejemplo n.º 3
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            if (rdbConductor.Checked & txtBuscar.Text.Length != 0)
            {
                EN.itemList cond = cmbConductor.SelectedItem as EN.itemList;


                List <EN.Produccion> other = produccionController.produccionxTaxista(txtBuscar.Text);
                if (other.Count == 0)
                {
                    MessageBox.Show("No hay registros asociados al conductor de identificacion " + txtBuscar.Text);
                }
                else
                {
                    dgvProducciones.DataSource = other.ToList();
                }
            }

            if (rdbPlaca.Checked && txtBuscar.Text.Length != 0)
            {
                List <EN.Produccion> other = produccionController.produccionPlaca(txtBuscar.Text);

                if (other.Count == 0)
                {
                    MessageBox.Show("No hay registros asociados al vehiculo de placas " + placa);
                }
                else
                {
                    dgvProducciones.DataSource = other.ToList();
                }
            }
        }
Ejemplo n.º 4
0
        private void btnActulizar_Click(object sender, EventArgs e)
        {
            //Claves foraneas
            String[]    DataTaxi = cmbTx.Text.Split(' ');
            EN.itemList cond     = cmbConductor.SelectedItem as EN.itemList;

            if (cmbConductor.Text.Length != 0 && placa != null && txtLiquidaciondia.Text.Length != 0 && txtTotal.Text.Length != 0)
            {
                //Calculo de dias liquidados
                TimeSpan resto = dtpFinal.Value.Date - dtpInicio.Value.Date;
                double   total = (resto.TotalDays + 1) * Convert.ToDouble(txtLiquidaciondia.Text.Trim());

                String placa = DataTaxi[0].Trim();

                //Instancia
                BR.Produccion p = new BR.Produccion();
                p.id         = Convert.ToInt32(dgvProducciones.CurrentRow.Cells["id"].Value);
                p.placa      = placa;
                p.inicio     = dtpInicio.Value.Date;
                p.final      = dtpFinal.Value.Date;
                p.valor      = total;
                p.id_taxista = (int)conductoresController.MostarConductor(cond.value).id;


                if (produccionController.ActualzarProduccion(p))
                {
                    MessageBox.Show("Se Actualizo El Registro, el vehiculo " + DataTaxi[0] + " registra una produccion de " + p.valor + "$ desde " + p.inicio + " hasta " + p.final);
                    llenarDataGridView();
                }
                else
                {
                    MessageBox.Show("Ocurio un error, intente de nuevo");
                }
            }
            else
            {
                MessageBox.Show("Verifique los datos");
            }
        }