Example #1
0
        public GatosTransportes_Entity verUnGasto(int codigo)
        {
            GatosTransportes_Entity st    = new GatosTransportes_Entity();
            ST_Asignaciones_DAL     getst = new ST_Asignaciones_DAL();

            return(getst.verUnGasto(codigo));
        }
Example #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtIdGasto.Text == "" || txtIdGasto.Text == "0")
            {
                try
                {
                    GatosTransportes_Entity gasto = new GatosTransportes_Entity();
                    gasto.idSolicitud  = Convert.ToInt32(txtIdSolicitud.Text.Trim());
                    gasto.idtransporte = Convert.ToInt32(txtIdTransporte.Text.Trim());
                    new BO.ST_Asignaciones_BOL().guardarEncabezadoGast(gasto);
                    getIdST(gasto.idSolicitud);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            if (txtIdGasto.Text == "" || txtIdGasto.Text == "0")
            {
                MessageBox.Show("Error al guardar el encabezado, por favor contacte al administrador");
            }
            else
            {
                try
                {
                    GatosTransportes_Entity st = new GatosTransportes_Entity();
                    st.factura     = txtFactura.Text;
                    st.totalGasto  = Convert.ToDecimal(txtTotal.Text.Trim());
                    st.idSolicitud = Convert.ToInt32(txtIdSolicitud.Text.Trim());
                    st.idTipoGasto = 1;
                    //st.fechafactura = dtpFecha.Value.Year + "/" + dtpFecha.Value.Month + "/" + dtpFecha.Value.Day;
                    st.fechafactura = dtpFecha.Value.Year + "/" + dtpFecha.Value.Month + "/" + dtpFecha.Value.Day;
                    st.Notas        = txtNotas.Text;
                    st.kms          = Convert.ToDecimal(txtKms.Text.Trim());
                    st.idGasto      = Convert.ToInt32(txtIdGasto.Text.Trim());
                    st.idtransporte = Convert.ToInt32(txtIdTransporte.Text.Trim());
                    if (txtDetalle.Text == "" || txtDetalle.Text == "0")
                    {
                        new BO.ST_Asignaciones_BOL().guardarDetalleGasto(st);
                        MessageBox.Show("Se ha guardado el gasto exitosamente");
                    }
                    else
                    {
                        st.idDetGasto  = Convert.ToInt32(txtDetalle.Text);
                        st.gastoPivote = Convert.ToDecimal(txtGastoPivote.Text);
                        new BO.ST_Asignaciones_BOL().actualizarDetalleGasto(st);
                        MessageBox.Show("Se ha actualizado el gasto exitosamente");
                    }

                    limpiar();
                    Bloquear();
                    ActualizaGrid();
                    getIdST(st.idSolicitud);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Example #3
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (txtDetalle.Text == "")
     {
         MessageBox.Show("No ha seleccionado ningun registro");
     }
     else
     {
         if (MessageBox.Show("Esta seguro de eliminar el registro", "Detalle de Solicitud",
                             MessageBoxButtons.YesNo, MessageBoxIcon.Question)
             == DialogResult.Yes)
         {
             try
             {
                 int cod = Convert.ToInt32(txtDetalle.Text);
                 GatosTransportes_Entity st = new GatosTransportes_Entity();
                 st.factura      = txtFactura.Text;
                 st.totalGasto   = Convert.ToDecimal(txtTotal.Text.Trim());
                 st.idSolicitud  = Convert.ToInt32(txtIdSolicitud.Text.Trim());
                 st.idGasto      = Convert.ToInt32(txtIdGasto.Text.Trim());
                 st.idtransporte = Convert.ToInt32(txtIdTransporte.Text.Trim());
                 st.idDetGasto   = Convert.ToInt32(txtDetalle.Text);
                 new BO.ST_Asignaciones_BOL().eliminarDetalleGasto(st);
                 MessageBox.Show("Se ha eliminado el gasto exitosamente");
                 limpiar();
                 Desbloquear();
             }catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
 }
Example #4
0
        public void actualizaDetalleGasto(GatosTransportes_Entity st)
        {
            cnn.updateSQL("UPDATE DETALLEGASTOTRANSPORTE SET facturaasociada='" + st.factura + "', montototal=" + st.totalGasto + ", fechafactura='" + st.fechafactura + "', notafactura = '" + st.Notas + "', " +
                          " tipogasto=" + st.idTipoGasto + " , kilometraje = " + st.kms + " WHERE idetallegasto = " + st.idDetGasto);

            actualizarGastoTotal(st.idSolicitud, st.totalGasto, st.gastoPivote, 2);
        }
Example #5
0
        public GatosTransportes_Entity verIdGasto(int idst)
        {
            GatosTransportes_Entity st    = new GatosTransportes_Entity();
            ST_Asignaciones_DAL     getst = new ST_Asignaciones_DAL();

            return(getst.getIdGasto(idst));
        }
Example #6
0
        public void insertaDetalleGasto(GatosTransportes_Entity st)
        {
            cnn.insertSQL("INSERT INTO DETALLEGASTOTRANSPORTE(facturaasociada, montototal, fechafactura, notafactura, tipogasto, idtransporte, idgastotransporte, idsolicitud, kilometraje) " +
                          " VALUES('" + st.factura + "'," + st.totalGasto + ",\'" + st.fechafactura + "\','" + st.Notas + "'," + st.idTipoGasto + "," + st.idtransporte + "," + st.idGasto + "," + st.idSolicitud + "," + st.kms + ")");

            actualizarGastoTotal(st.idSolicitud, st.totalGasto, st.gastoPivote, 1);
        }
Example #7
0
        public DataTable verTodosGastos(GatosTransportes_Entity st)
        {
            DataTable           dt = new DataTable();
            ST_Asignaciones_DAL gr = new ST_Asignaciones_DAL();

            dt = gr.todosGastos(st);
            return(dt);
        }
Example #8
0
        public DataTable todosGastos(GatosTransportes_Entity st)
        {
            DataTable dtRegistros = new DataTable();

            dtRegistros = cnn.getSQL("SELECT idetallegasto as CODIGO, facturaasociada AS FACTURA, montototal AS GASTO, fechafactura AS FECHA, " +
                                     " notafactura AS NOTAS, TP.nombre AS TIPO_GASTO " +
                                     " FROM DETALLEGASTOTRANSPORTE DGT " +
                                     " JOIN TIPOGASTO TP ON DGT.tipogasto = TP.idgasto " +
                                     " WHERE idsolicitud = " + st.idSolicitud);
            return(dtRegistros);
        }
Example #9
0
 public void ActualizaGrid()
 {
     try
     {
         GatosTransportes_Entity st = new GatosTransportes_Entity();
         st.idSolicitud       = Convert.ToInt32(txtIdSolicitud.Text.Trim());
         dgvGastos.DataSource = new ST_Asignaciones_BOL().verTodosGastos(st);
         dgvGastos.Refresh();
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.Message);
     }
 }
Example #10
0
        public GatosTransportes_Entity getIdGasto(int idst)
        {
            GatosTransportes_Entity st = new GatosTransportes_Entity();
            DataTable dtRegistro       = new DataTable();

            dtRegistro = cnn.getSQL("SELECT ST.idtransporte, MGT.idgastotransporte, MGT.gastotoal, MGT.idAutorizacion " +
                                    " FROM SOLICITUDTRANSPORTE ST " +
                                    " LEFT JOIN M_GASTOTRANSPORTE MGT ON ST.idsolicitud = MGT.idsolicitud " +
                                    " WHERE ST.idsolicitud = " + idst);
            foreach (DataRow row in dtRegistro.Rows)
            {
                foreach (DataColumn column in dtRegistro.Columns)
                {
                    st.idtransporte = Convert.ToInt32(row["idtransporte"]);
                    if (row["idgastotransporte"] == DBNull.Value)
                    {
                        st.idGasto    = 0;
                        st.gastoTotal = 0;
                        st.idAutoriza = 0;
                    }
                    else
                    {
                        st.idGasto    = Convert.ToInt32(row["idgastotransporte"]);
                        st.gastoTotal = Convert.ToDecimal(row["gastotoal"]);
                        if (row["idAutorizacion"] == DBNull.Value)
                        {
                            st.idAutoriza = 0;
                        }
                        else
                        {
                            st.idAutoriza = Convert.ToInt32(row["idAutorizacion"]);
                        }
                    }
                }
            }
            return(st);
        }
Example #11
0
        public GatosTransportes_Entity verUnGasto(int codigo)
        {
            GatosTransportes_Entity st = new GatosTransportes_Entity();
            DataTable dtRegistro       = new DataTable();

            dtRegistro = cnn.getSQL("SELECT * FROM DETALLEGASTOTRANSPORTE WHERE idetallegasto = " + codigo);
            foreach (DataRow row in dtRegistro.Rows)
            {
                foreach (DataColumn column in dtRegistro.Columns)
                {
                    st.idDetGasto   = Convert.ToInt32(row["idetallegasto"]);
                    st.factura      = row["facturaasociada"].ToString();
                    st.totalGasto   = Convert.ToDecimal(row["montototal"]);
                    st.fechafactura = row["fechafactura"].ToString();
                    st.Notas        = row["notafactura"].ToString();
                    st.idTipoGasto  = Convert.ToInt32(row["tipogasto"]);
                    st.idtransporte = Convert.ToInt32(row["idtransporte"]);
                    st.idSolicitud  = Convert.ToInt32(row["idsolicitud"]);
                    st.idGasto      = Convert.ToInt32(row["idgastotransporte"]);
                    st.kms          = Convert.ToDecimal(row["kilometraje"]);
                }
            }
            return(st);
        }
Example #12
0
 public void insertaEncabezadoGasto(GatosTransportes_Entity st)
 {
     cnn.insertSQL("INSERT INTO M_GASTOTRANSPORTE(idtransporte, idsolicitud, gastotoal) " +
                   " VALUES(" + st.idtransporte + "," + st.idSolicitud + ",0)");
 }
Example #13
0
        public void actualizaEncabezadoGasto(GatosTransportes_Entity st)
        {
            ST_Asignaciones_DAL guardar = new ST_Asignaciones_DAL();

            guardar.actualizaEncabezadoGast(st);
        }
Example #14
0
        public void guardarEncabezadoGast(GatosTransportes_Entity st)
        {
            ST_Asignaciones_DAL guardar = new ST_Asignaciones_DAL();

            guardar.insertaEncabezadoGasto(st);
        }
Example #15
0
        public void eliminarDetalleGasto(GatosTransportes_Entity st)
        {
            ST_Asignaciones_DAL guardar = new ST_Asignaciones_DAL();

            guardar.eliminaDetalleGasto(st);
        }
Example #16
0
        public void actualizarDetalleGasto(GatosTransportes_Entity st)
        {
            ST_Asignaciones_DAL guardar = new ST_Asignaciones_DAL();

            guardar.actualizaDetalleGasto(st);
        }
Example #17
0
 public void actualizaEncabezadoGast(GatosTransportes_Entity st)
 {
     cnn.updateSQL("UPDATE M_GASTOTRANSPORTE SET gastotoal = " + st.totalGasto + " WHERE idsolicitud = " + st.idSolicitud);
 }
Example #18
0
        public void eliminaDetalleGasto(GatosTransportes_Entity st)
        {
            cnn.deleteSQL("DELETE FROM DETALLEGASTOTRANSPORTE WHERE idetallegasto = " + st.idDetGasto);

            actualizarGastoTotal(st.idSolicitud, st.totalGasto, st.gastoPivote, 3);
        }