private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            OrdenDeTrabajo ordenActual = (OrdenDeTrabajo)GetCurrentRow();

            if (ordenActual != null)
            {
                FechaActividad_xrTableCell.Text = (ordenActual.FechaFinalActividad).AddDays(-7).ToShortDateString();
            }
        }
Ejemplo n.º 2
0
        public NominaXtraReport(OrdenDeTrabajo ot)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(ReportesWaitForm), true, true);
            }
            catch (Exception)
            {
                SplashScreenManager.CloseForm();
                SplashScreenManager.ShowForm(typeof(ReportesWaitForm), true, true);
            }
            var dc = new NegocioDataContext();
            var anOrdenDeTrabajo = dc.OrdenDeTrabajo.FirstOrDefault(c => c.OrdenDeTrabajoID == ot.OrdenDeTrabajoID);

            InitializeComponent();
            if (anOrdenDeTrabajo.ImporteDieta == 0)
            {
                Dieta_xrTableCell.Visible           = false;
                DietaFooter_xrTableCell46.Visible   = false;
                Dieta_xrTableCell46.Visible         = false;
                DietaFooter_xrTableCell46.Visible   = false;
                NetoAcobrarHeader_xrTableCell.Width = NetoCobrarDetail_xrTableCell.Width = NetoCobrarReport_xrTableCell.Width = NetoCobrarPage_xrTableCell.Width = 120;
            }
            ConfiguracionGeneral configuracion = dc.ConfiguracionGeneral.FirstOrDefault();

            if (configuracion.LogoAgencia != null)
            {
                MemoryStream ms           = new MemoryStream(configuracion.LogoAgencia);
                Bitmap       imagenBitmap = new Bitmap(ms);
                xrPictureBox1.Image = imagenBitmap;
            }
            NombreAgencia_xrTableCell.Text                      = configuracion.Agencia.Trim();
            Descuentos_xrTableCell.Text                         = anOrdenDeTrabajo.Descuentos.ToString().Trim();
            IngresoActividad_xrTableCell.Text                   = Convert.ToString(anOrdenDeTrabajo.ImporteFinal);
            PorCientoCLiente_xrTableCell.Text                   = Convert.ToString(anOrdenDeTrabajo.PorcientoCliente);
            ImporteCliente_xrTableCell.Text                     = Convert.ToString(anOrdenDeTrabajo.ImporteIngresaCliente);
            PorcientoIngresoEmpresa_xrTableCell.Text            = Convert.ToString(anOrdenDeTrabajo.PorCientoIngresaEmpresa);
            ImporteIngresaEmpresa_xrTableCell.Text              = Convert.ToString(anOrdenDeTrabajo.ImporteIngresaAgencia);
            PorCientoUtilidadEmpresa_xrTableCell.Text           = Convert.ToString(anOrdenDeTrabajo.PorcientoUtilidadEmpresa);
            ImporteUtilidadEmpresa_xrTableCell.Text             = Convert.ToString(anOrdenDeTrabajo.ImporteUtilidadAgencia);
            PorCientoUnidadArtistica_xrTableCell.Text           = Convert.ToString(anOrdenDeTrabajo.PorCientoUnidadArtistica);
            ImporteUnidadArtisticaSinDescuento_xrTableCell.Text =
                Convert.ToString(anOrdenDeTrabajo.ImporteUnidadArtisticaSinDescuento);
            Descuentos_xrTableCell.Text = Convert.ToString(-1 * anOrdenDeTrabajo.Descuentos);
            IngresoArtistaConDescuento_xrTableCell.Text = Convert.ToString(anOrdenDeTrabajo.ImporteConDescuento);
            Onat_xrTableCell.Text     = Convert.ToString(anOrdenDeTrabajo.Onat);
            Efectivo_xrTableCell.Text = Convert.ToString(anOrdenDeTrabajo.ImporteNetoQueSeCobraReal);



            //ImporteDistribuir_xrTableCell.Text = anOrdenDeTrabajo.ImporteConDescuento.ToString().Trim();
            ConsecutivoString_xrTableCell.Text    = anOrdenDeTrabajo.GetNominaAsociada().ConsecutivoString;
            ActividadConsecutivo_xrLabel.Text     = anOrdenDeTrabajo.ConsecutivoString;
            linqServerModeSource1.QueryableSource =
                dc.ParticipantesDeAcividad.Where(
                    c => c.ActividadId == anOrdenDeTrabajo.OrdenDeTrabajoID); NombrerealizaNomina_xrLabel.Text = LoginHelper.UsuarioRegistrado.NombreCompleto.Trim();
        }
Ejemplo n.º 3
0
        private bool SalvarActividad()
        {
            try
            {
                if (!dxValidationProvider1.Validate())
                {
                    return(false);
                }
                var actividad = GetOrdenDeFormulario();
                if (actividad == null)
                {
                    if (ATipoDeActividad == Enumerados.TipoActividad.Factura)
                    {
                        Conceptos_Tab.Enabled = false;
                    }
                    MessageBox.Show("Error alsalvar datos, Verifique los datos insertados", "Error");
                    return(false);
                }


                if (actividad.TieneNominaAsociada && !LoginHelper.EliminaValidacion)
                {
                    MessageBox.Show("La actividad tiene una nomina asociada por lo que no puede editarse");
                    return(false);
                }
                GlobalActividad = OrdenDeTrabajo.SalvaActividad(actividad.AgrupacionId, actividad.NumeroContrato,
                                                                actividad.FechaConfeccion,
                                                                actividad.FechaIncialActividad, actividad.FechaFinalActividad, actividad.ClienteQueContrataId,
                                                                actividad.LugarDePresentacion, actividad.ImportePorActividad, actividad.TipoMonedaId,
                                                                actividad.CantidadActividades,
                                                                actividad.OrdenDeTrabajoID, ATipoDeActividad, actividad.EsPorCover, AIsAnUpdate ? actividad.Anno : ConfiguracionGeneral.Anno, actividad.Observaciones, actividad.Nota, actividad.ProyectosId, AGLobalDataContext);
                AgrupacionControl.Properties.Buttons[1].Enabled = GlobalActividad != null;

                //_GLobalDataContext = new NegocioDataContext();
                NumOT_labelControl.Text = GlobalActividad.NumeroDeOrden;
                AOrdenDeTrabajoId       = GlobalActividad.OrdenDeTrabajoID;
                //PrintPreview_simpleButton.Enabled = true;
                NumOT_labelControl.ForeColor = Color.DarkBlue;
                NumOT_labelControl.ToolTip   = "Numero de la Orden de Trabajo";
                //GlobalActividad = _Actividad;
                AGeneraActualizacionDeTablaDeActividades = true;
                if (ATipoDeActividad != Enumerados.TipoActividad.Factura)
                {
                    return(true);
                }
                PopulaImporteGridControl();
                Conceptos_Tab.Enabled = true;
                Principal_TabbedControlGroup.SelectedTabPage = Conceptos_Tab;

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        //
        // GET: /OrdenDeTrabajo/Delete/5

        public ActionResult Delete(int id = 0)
        {
            OrdenDeTrabajo ordendetrabajo = db.OrdenDeTrabajo.Find(id);

            if (ordendetrabajo == null)
            {
                return(HttpNotFound());
            }
            return(View(ordendetrabajo));
        }
 public ActionResult CambiarEstado(OrdenDeTrabajo ordenDeTrabajo)
 {
     db.Entry(ordenDeTrabajo).State = EntityState.Modified;
     if (ordenDeTrabajo.TipoEstadoID == 4)
     {
         ordenDeTrabajo.FechaEntrega = DateTime.Now;
     }
     db.SaveChanges();
     return(RedirectToAction("../Clientes/Details/" + ordenDeTrabajo.ClienteID));
 }
Ejemplo n.º 6
0
        private void Deudas_simpleButton_Click(object sender, EventArgs e)
        {
            PopupGestionDeudaXtraForm popup = new PopupGestionDeudaXtraForm(AAct.AgrupacionId, AGlobalDataContext, AAct.TipoMonedaId);

            if (popup.ShowDialog() == DialogResult.OK)
            {
                AGlobalDataContext = new NegocioDataContext();
                AAct = AGlobalDataContext.OrdenDeTrabajo.FirstOrDefault(c => c.OrdenDeTrabajoID == AAct.OrdenDeTrabajoID);
                CalculaDeuda();
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="orden"></param>
 public void CloseSolicitudesRepuestos(OrdenDeTrabajo orden)
 {
     foreach (var s in orden.SolicitudesRespuestos)
     {
         if (s.FechaCierre == null)
         {
             s.FechaCierre     = DateTime.Now;
             db.Entry(s).State = EntityState.Modified;
         }
     }
 }
Ejemplo n.º 8
0
        //private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        //{
        //    var _column = gridView1.FocusedColumn;
        //    if (_column != colImporte) return;
        //    var descuentoAcumulado = _globalOrdenDeTrabajo.GetDescuento();
        //    if (descuentoAcumulado + Convert.ToDecimal(e.Value) > _globalOrdenDeTrabajo.ImporteFinal)
        //    {
        //        e.Valid = false;
        //        e.ErrorText = "El descuento total no puede exceder el importe de la actividad";
        //    }

        //    //            switch (_FieldName)
        //    //            {
        //    ////case "Desde":
        //    //                    //{
        //    //                    //    Presentacion_gridView.Columns["Hasta"].RealColumnEdit.
        //    //                    //    }
        //    //                    //    break;
        //    //            }
        //    //            //    case "Hasta":
        //    //            //    {
        //    //            //        if ((DateTime)e.Value > FechaFinalDateEdit.DateTime)
        //    //            //        {
        //    //            //            e.Valid = false;
        //    //            //            e.ErrorText = "Verifique Fecha";}
        //    //            //        break;
        //    //            //    }
        //}

        //private void gridView1_Click(object sender, EventArgs e)
        //{
        //    var gridView = gridView1;
        //    Point clickPoint = gridControl1.PointToClient(MousePosition);
        //    var hitInfo = gridView.CalcHitInfo(clickPoint);
        //    if (hitInfo.InRowCell)
        //    {
        //        int rowHandle = hitInfo.RowHandle;
        //        GridColumn column = hitInfo.Column;
        //        //MessageBox.Show(column.Name + " "+rowHandle);
        //        if (column == Delete_gridColumn)
        //        {
        //            if (
        //                MessageBox.Show("Esta acción no es reversible, esta seguro", "Atención", MessageBoxButtons.YesNo,
        //                    MessageBoxIcon.Hand) == DialogResult.Yes)
        //            {
        //                DescuentoPorActividad descuentoPorActividad = (DescuentoPorActividad)gridView.GetRow(rowHandle);
        //                dc.DescuentoPorActividad.DeleteOnSubmit(descuentoPorActividad);
        //                dc.SubmitChanges();
        //                gridControl1.DataSource = dc.DescuentoPorActividad.Where(c => c.DocumentoReferenciaId == _globalOrdenDeTrabajo.OrdenDeTrabajoID);

        //            }
        //        }
        //    }
        //}

        private void Ok_simpleButton_Click(object sender, EventArgs e)
        {
            try
            {
                var fechaDeEntregaCheque = string.IsNullOrEmpty(Convert.ToString(Cheque_textEdit.EditValue))
                    ? FechaEntregaCheque_dateEdit.DateTime
                    : Convert.ToDateTime(FechaEntregaCheque_dateEdit.EditValue);
                //string numeroCheque = Convert.ToString(Cheque_textEdit.EditValue);
                if (
                    AAct.CierraOrdenDeTrabajo(
                        FechaCierre_dateEdit.EditValue == null ? DateTime.Today : FechaCierre_dateEdit.DateTime,
                        Convert.ToDecimal(ParaUAPorciento_textEdit.EditValue),
                        Decimal.Round((decimal)IngresoTotalActividadTotal_textEdit.EditValue, 2),
                        Convert.ToString(Cheque_textEdit.EditValue),
                        Convert.ToString(Observacion_memoEdit.EditValue).Trim(),
                        (Convert.ToDecimal(PorcientoCliente_textEdit.EditValue)), fechaDeEntregaCheque,
                        Convert.ToString(Nota_memoExEdit.EditValue))
                    )
                {
                    AAct =
                        new NegocioDataContext().OrdenDeTrabajo.FirstOrDefault(
                            c => c.OrdenDeTrabajoID == AAct.OrdenDeTrabajoID);
                    if (AAct.TieneDeudaHistorico)
                    {
                        AAct.EliminaHistoricoDeudas();
                    }

                    if (AAct.Agrupacion.GetDeuda(AAct.TipoMonedaId) > 0 &&
                        (Convert.ToDecimal(Descuentos_buttonEdit.EditValue) <= 0))
                    {
                        XtraMessageBox.AllowHtmlText = true;
                        if (XtraMessageBox.Show(
                                "La Agrupación tiene deuda en esta moneda<br><b>Desea Regresar a la ventana de cierre para registrar algún descuento?",
                                "Información",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                        {
                        }
                    }
                    else
                    {
                        if (Convert.ToDecimal(Descuentos_buttonEdit.EditValue) > 0)
                        {
                            AAct.InsertaHistoricoDeudas((DateTime)AAct.FechaLiquidacion);
                        }
                    }
                    Print_dropDownButton.Enabled = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error al cerrar la Orden");
            }
        }
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (_estado == estados.nuevo && validarDatos() == termino.aprobado)
            {
                OrdenDeTrabajo orden = new OrdenDeTrabajo()
                {
                    fechaPlan = infoPlan.fechaProduccion,
                    estado    = new Estado()
                    {
                        idEstado = 19
                    },
                    idPlan   = infoPlan.idPlan,
                    producto = new Producto()
                    {
                        idProducto = infoPlan.producto.idProducto
                    },
                    horaInicio = Convert.ToDateTime(txt_inicio.Text),
                    horaFin    = Convert.ToDateTime(txt_fin.Text),
                    maquinaria = new Maquinaria()
                    {
                        idMaquinaria = (int)cmb_maquinaria.SelectedValue
                    },
                    empleado = new Empleado()
                    {
                        idEmpleado = (int)cmb_empleado.SelectedValue
                    },
                    fechaCreacion = dtp_creacion_OT.Value.Date,
                    cantidad      = (float)Convert.ToDouble(lbl_cant.Text),
                };
                try
                {
                    OrdenDeTrabajoDAO.InsertPadre(orden, ordenhija);
                }
                catch (ApplicationException ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }

                MessageBox.Show("Registrado con Exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);

                bloquear                  = false;
                btn_guardar.Enabled       = false;
                btn_cargar_combos.Enabled = false;
                txt_inicio.Enabled        = false;
                limpiar();
                _estado = estados.guardado;
            }
            else
            {
            }

            btn_salir_consulta_Click(sender, e);
        }
 public ActionResult Edit(OrdenDeTrabajo ordendetrabajo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ordendetrabajo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idUsuario  = new SelectList(db.Usuario, "idUsuario", "nombreUsuario", ordendetrabajo.idUsuario);
     ViewBag.idVehiculo = new SelectList(db.Vehiculo, "idVehiculo", "nroPatente", ordendetrabajo.idVehiculo);
     return(View(ordendetrabajo));
 }
        //
        // GET: /OrdenDeTrabajo/Edit/5

        public ActionResult Edit(int id = 0)
        {
            OrdenDeTrabajo ordendetrabajo = db.OrdenDeTrabajo.Find(id);

            if (ordendetrabajo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.idUsuario  = new SelectList(db.Usuario, "idUsuario", "nombreUsuario", ordendetrabajo.idUsuario);
            ViewBag.idVehiculo = new SelectList(db.Vehiculo, "idVehiculo", "nroPatente", ordendetrabajo.idVehiculo);
            return(View(ordendetrabajo));
        }
Ejemplo n.º 12
0
        private void Ot_Report_simpleButton_Click(object sender, EventArgs e)
        {
            var ordenDeTrabajo = OrdenDeTrabajo.GetOrdenDeTrabajoById(AOrdenDeTrabajoId);

            if (ordenDeTrabajo == null)
            {
                MessageBox.Show("Salve Antes la orden de Trabajo");
            }
            else
            {
                ordenDeTrabajo.MuestraReporte();
            }
        }
        public static void finalizarOTPadre(OrdenDeTrabajo ot, double canPed, double canPlan, List <DetalleProducto> tabla)
        {
            Acceso ac = new Acceso();

            SqlConnection  cn   = new SqlConnection(ac.getCadenaConexion());
            SqlTransaction tran = null;

            string sql = "UPDATE [Luiggi].[dbo].[OrdenTrabajo] SET [idEstado] = 20, [cantidadProducidaReal]= @cantreal, [observaciones] = @observaciones WHERE idOrdenTrabajo =  @idOrdenTrabajo ";

            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.AddWithValue("@idOrdenTrabajo", ot.idOrdenTrabajo);
            cmd.Parameters.AddWithValue("@cantreal", ot.cantidadReal);
            cmd.Parameters.AddWithValue("@observaciones", ot.observaciones);

            try
            {
                cn.Open();
                tran            = cn.BeginTransaction();
                cmd.Connection  = cn;
                cmd.Transaction = tran;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();

                ProductoDAO.UpdateStockReservadoYDisponibleOTFinalizada(ot.producto.idProducto, canPlan, canPed, cn, tran);

                foreach (DetalleProducto det in tabla)
                {
                    ProductoDAO.UpdateStockReservadoYDisponibleMatiaPrimaOTfinalizada(det.idProducto, det.cantidad, det.cantidadProductos, cn, tran);
                }

                DetallePedidoDAO.finalizarDetalleDePedido(ot.fechaCreacion, ot.producto.idProducto, tran, cn);

                tran.Commit();
            }
            catch (ArgumentException ex)
            {
                tran.Rollback();
                throw new ApplicationException("Error en BD: " + ex.Message);
            }
            catch (SqlException ex)
            {
                tran.Rollback();
                throw new ApplicationException("Error en BD: " + ex.Message);
            }
            finally
            {
                cn.Close();
            }
        }
 private void ImporteTotal_xrTableCell_SummaryRowChanged(object sender, EventArgs e)
 {
     if (!EsFacturaDeProyecto)
     {
         OrdenDeTrabajo ordenActual = (OrdenDeTrabajo)GetCurrentRow();
         decimal        importe     = ordenActual.ImporteNetoQueSeCobraReal;
         AGlobalImporteFinal     += importe;
         Importe_xrTableCell.Text = importe.ToString();
     }
     else
     {
         Importe_xrTableCell.Text = AGlobalImporteFinal.ToString();
     }
 }
Ejemplo n.º 15
0
        public static string WebController(this OrdenDeTrabajo odt)
        {
            if (odt is OrdenDeTrabajoMantenimientoCorrectivo)
            {
                return(OdtMCorrectivoController);
            }

            if (odt is OrdenDeTrabajoMantenimientoPreventivo)
            {
                return(OdtMPreventivoController);
            }

            return(OdtBaseController);
        }
        //
        // GET: /OrdenDeTrabajo/Details/5

        public ActionResult Details(int idOrdenDeTrabajo = 0)
        {
            OrdenDeTrabajo ordendetrabajo = db.OrdenDeTrabajo.Find(idOrdenDeTrabajo);

            foreach (RepuestoOT repuestoOT in db.RepuestoOT.Where(r => r.idOrdenDeTrabajo == idOrdenDeTrabajo))
            {
                ordendetrabajo.RepuestoOT.Add(repuestoOT);
            }
            if (ordendetrabajo == null)
            {
                return(HttpNotFound());
            }
            return(View(ordendetrabajo));
        }
Ejemplo n.º 17
0
        private void Print_dropDownButton_Click(object sender, EventArgs e)
        {
            var ordenDeTrabajo = OrdenDeTrabajo.GetOrdenDeTrabajoById(AOrdenDeTrabajoId);

            if (ordenDeTrabajo == null)
            {
                MessageBox.Show("Salve Antes la orden de Trabajo");
                Print_dropDownButton.DropDownControl = null;
            }
            else
            {
                Print_dropDownButton.DropDownControl = Print_popupMenu;
            }
        }
        // GET: /OrdenDeTrabajos/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OrdenDeTrabajo ordenDeTrabajo = db.OrdenDeTrabajo.Find(id);

            if (ordenDeTrabajo == null)
            {
                return(HttpNotFound());
            }
            return(View(ordenDeTrabajo));
        }
        public ActionResult Close(int idOrdenDeTrabajo = 0)
        {
            float          precioTotal = 0;
            OrdenDeTrabajo orden       = db.OrdenDeTrabajo.Find(idOrdenDeTrabajo);

            foreach (RepuestoOT repuestoOT in db.RepuestoOT.Where(r => r.idOrdenDeTrabajo == idOrdenDeTrabajo))
            {
                precioTotal = precioTotal + (float)(repuestoOT.Repuesto.costo * repuestoOT.cantidadDeRepuesto) + (float)(repuestoOT.cantidadHorasTrabajo * 350);
            }
            orden.total = precioTotal;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,ClienteID,FechaIngreso,FechaProblableEntrega,FechaEntrega,TipoEstadoID,TipoEquipoID,TipoMarcaID,Caracteristicas,TipoTrabajoID,Observaciones")] OrdenDeTrabajo ordenDeTrabajo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ordenDeTrabajo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("../Clientes/Details/" + ordenDeTrabajo.ClienteID));
     }
     ViewBag.TipoEquipoID  = new SelectList(db.TipoEquipo, "ID", "Nombre", ordenDeTrabajo.TipoEquipoID);
     ViewBag.TipoEstadoID  = new SelectList(db.TipoEstado, "ID", "Nombre", ordenDeTrabajo.TipoEstadoID);
     ViewBag.TipoMarcaID   = new SelectList(db.TipoMarca, "ID", "Nombre", ordenDeTrabajo.TipoMarcaID);
     ViewBag.TipoTrabajoID = new SelectList(db.TipoTrabajo, "ID", "Nombre", ordenDeTrabajo.TipoTrabajoID);
     ViewBag.ClienteID     = new SelectList(db.Cliente, "ID", "Apellido", ordenDeTrabajo.ClienteID);
     return(View(ordenDeTrabajo));
 }
Ejemplo n.º 21
0
        private void SalvaValoresDeCierre()
        {
            var actividad =
                AGlobalDataContext.OrdenDeTrabajo.FirstOrDefault(
                    c => c.OrdenDeTrabajoID == AGlobalActividad.OrdenDeTrabajoID);

            actividad.PorcientoCliente         = Convert.ToInt32(PorCientoCliente_textEdit.EditValue);
            actividad.PorCientoUnidadArtistica = Convert.ToInt32(ParaUAPorciento_textEdit.EditValue);
            actividad.ImporteFinal             =
                decimal.Round(Convert.ToDecimal(IngresoActividad_textEdit.EditValue), 2);
            AGlobalDataContext.SubmitChanges();
            AGlobalActividad = actividad;
            ActualizaDiferencia();
            SeValidaTab(Documentos_layoutControlGroup, Documentos_dxValidationProvider);
            SeValidaTab(Distribucion_layoutControlGroup, Distribucion_dxValidationProvider);
        }
        public ActionResult Create(OrdenDeTrabajo ordendetrabajo)
        {
            if (ModelState.IsValid)
            {
                ordendetrabajo.fechaIngreso = DateTime.Now;
                ordendetrabajo.idUsuario    = int.Parse(Session["idUser"].ToString());

                db.OrdenDeTrabajo.Add(ordendetrabajo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.idUsuario  = new SelectList(db.Usuario, "idUsuario", "nombreUsuario", ordendetrabajo.idUsuario);
            ViewBag.idVehiculo = new SelectList(db.Vehiculo, "idVehiculo", "nroPatente", ordendetrabajo.idVehiculo);
            return(View(ordendetrabajo));
        }
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (_estado == estados.nuevo && validarDatos() == termino.aprobado)
            {
                OrdenDeTrabajo orden = new OrdenDeTrabajo();

                orden.fechaPlan = infoPlan.fechaProduccion;
                orden.estado    = new Estado()
                {
                    idEstado = 19
                };
                orden.idPlan   = infoPlan.idPlan;
                orden.producto = new Producto()
                {
                    idProducto = infoPlan.producto.idProducto
                };
                orden.horaInicio         = Convert.ToDateTime(txt_inicio.Text);
                orden.horaFin            = Convert.ToDateTime(txt_fin.Text);
                orden.productoIntermedio = new Producto()
                {
                    idProducto = prodInt.idProducto
                };
                orden.maquinaria = new Maquinaria()
                {
                    idMaquinaria = (int)cmb_maquinaria.SelectedValue, Nombre = ((Maquinaria)cmb_maquinaria.SelectedItem).Nombre
                };
                orden.empleado = new Empleado()
                {
                    idEmpleado = (int)cmb_empleado.SelectedValue, Nombre = ((Empleado)cmb_empleado.SelectedItem).Nombre
                };
                orden.fechaCreacion = dtp_creacion_OT.Value.Date;
                orden.cantidad      = (float)Convert.ToDouble(lbl_cant.Text);



                iniciador.otHija = orden;

                MessageBox.Show("Registrado con Exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                _estado = estados.guardado;
                Close();
                Dispose();
            }
            else
            {
            }
        }
        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            OrdenDeTrabajo ordenActual = (OrdenDeTrabajo)GetCurrentRow();
            decimal        importe     = 0;

            if (ordenActual.EsFacturaDeProyecto)
            {
                importe = AGlobalImporteFinal;
            }
            else
            {
                importe = ordenActual.ImporteNetoQueSeCobraReal;
            }
            ConsecutivoString_xrTableCell.Text = ordenActual.ConsecutivoString;

            // _GlobalImporteFinal += importe*95/100;
            Importe_xrTableCell.Text = importe.ToString();
        }
 public PopupCierreProyectoXtraForm(Proyectos aProyectos)
 {
     InitializeComponent();
     AProyecto = aProyectos;
     AFactura  = AProyecto.FacturaDeCierre;
     if (AFactura != null)
     {
         FechaCierre_dateEdit.DateTime = Convert.ToDateTime(AFactura.FechaLiquidacion);
         Cache_textEdit.EditValue      = AFactura.ImporteCache;
         DietaTotal_textEdit.EditValue = AFactura.ImporteDieta;
         if (AFactura.FechaDePago != null)
         {
             Cobrado_checkEdit.Checked    = true;
             FechaCobro_dateEdit.DateTime = Convert.ToDateTime(AFactura.FechaDePago);
         }
         Notas_memoEdit.Text = AFactura.Observaciones;
     }
 }
 private void dgv_OTproductosHijos_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgv_OTproductosHijos.CurrentCell is DataGridViewButtonCell)
     {
         if (dgv_OTproductosHijos.Rows[dgv_OTproductosHijos.CurrentRow.Index].DefaultCellStyle.BackColor != Color.LightGreen)
         {
             try
             {
                 double         canti = (double)dgv_OTproductosHijos.Rows[dgv_OTproductosHijos.CurrentRow.Index].Cells["cant"].Value;
                 OrdenDeTrabajo orden = new OrdenDeTrabajo();
                 orden.idOrdenTrabajo = (int)dgv_OTproductosHijos.Rows[dgv_OTproductosHijos.CurrentRow.Index].Cells["idOT"].Value;
                 Producto prod = new Producto();
                 prod.idProducto = (int)dgv_OTproductosHijos.Rows[dgv_OTproductosHijos.CurrentRow.Index].Cells["idProd"].Value;
                 prod.Nombre     = dgv_OTproductosHijos.Rows[dgv_OTproductosHijos.CurrentRow.Index].Cells["poductoDetalle"].Value.ToString();
                 UnidadMedida unidad = new UnidadMedida();
                 unidad.Nombre  = dgv_OTproductosHijos.Rows[dgv_OTproductosHijos.CurrentRow.Index].Cells["unidadMedida"].Value.ToString();
                 prod.Unidad    = unidad;
                 orden.producto = prod;
                 orden.cantidad = canti;
                 ActualizarStock act = new ActualizarStock(orden);
                 act.ShowDialog();
                 if (orden.estado != null)
                 {
                     if (orden.estado.Nombre == "LISTO")
                     {
                         MessageBox.Show("Finalizado con éxito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                         dgv_OTproductosHijos.CurrentRow.DefaultCellStyle.BackColor = Color.LightGreen;
                         dgv_OTproductosHijos.CurrentRow.Cells["cantReal"].Value    = orden.cantidadReal;
                     }
                 }
             }
             catch (ApplicationException ex)
             {
                 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
             }
             catch (FormatException ex)
             {
                 MessageBox.Show("Ingrese solo números", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
             }
         }
     }
     dgv_OTproductosHijos.ClearSelection();
 }
Ejemplo n.º 27
0
        private void PopulaControles()
        {
            var proximoNumeroOt = OrdenDeTrabajo.GetProximoNumeroDeActividad(ATipoDeActividad);

            if (proximoNumeroOt == string.Empty)
            {
                return;
            }
            monedaLookUpEdit.Properties.DataSource  = AGLobalDataContext.TipoMoneda.Where(c => c.OrdenDeTrabajo);
            AgrupacionControl.Properties.DataSource = AGLobalDataContext.Agrupacion.Where(a => a.PerteneceACatalogo).OrderBy(c => c.Nombre);
            cantidadActividadesSpinEdit.EditValue   = 1;
            FechaConfecciontimeEdit.DateTime        = DateTime.Today;
            NumOT_labelControl.Text = proximoNumeroOt;
            fechaIncialActividadDateEdit.Properties.MinValue = FechaConfecciontimeEdit.DateTime;
            fechaFinalActividadDateEdit.Properties.MinValue  = FechaConfecciontimeEdit.DateTime;
            NumOT_labelControl.ToolTip =
                string.Format("Numero de Orden de Trabajo Propuesto, este número puede variar una vez salvada la misma");
            proyectosBindingSource.DataSource = AGLobalDataContext.Proyectos;
        }
        // GET: /OrdenDeTrabajos/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OrdenDeTrabajo ordenDeTrabajo = db.OrdenDeTrabajo.Find(id);

            if (ordenDeTrabajo == null)
            {
                return(HttpNotFound());
            }

            ViewBag.ClienteID     = ordenDeTrabajo.ClienteID;
            ViewBag.ClienteNombre = ordenDeTrabajo.Cliente.Apellido + ", " + ordenDeTrabajo.Cliente.Nombre;
            ViewBag.TipoEquipoID  = new SelectList(db.TipoEquipo, "ID", "Nombre", ordenDeTrabajo.TipoEquipoID);
            ViewBag.TipoEstadoID  = new SelectList(db.TipoEstado, "ID", "Nombre", ordenDeTrabajo.TipoEstadoID);
            ViewBag.TipoMarcaID   = new SelectList(db.TipoMarca, "ID", "Nombre", ordenDeTrabajo.TipoMarcaID);
            ViewBag.TipoTrabajoID = new SelectList(db.TipoTrabajo, "ID", "Nombre", ordenDeTrabajo.TipoTrabajoID);

            return(View(ordenDeTrabajo));
        }
Ejemplo n.º 29
0
        private void Salvar_simpleButton_Click(object sender, EventArgs e)
        {
            if (dxValidationProvider1.Validate())
            {
                if (!AIsAnUpdate)
                {
                    var ordenSemejante = OrdenDeTrabajo.GetActividadSemejante(fechaIncialActividadDateEdit.DateTime,
                                                                              Convert.ToInt32(clienteQueContrataIdComboBoxEdit.EditValue),
                                                                              Convert.ToInt32(monedaLookUpEdit.EditValue), Convert.ToInt32(AgrupacionControl.EditValue));
                    if (ordenSemejante != null)
                    {
                        if (
                            MessageBox.Show(
                                string.Format(
                                    "La orden {0} confeccionada el {1} con lugar de presentacion: {2}, tiene datos muy semejantes. Desea salvar, no obstante, la orden de trabajo actual?",
                                    ordenSemejante.ConsecutivoString, ordenSemejante.FechaConfeccion,
                                    ordenSemejante.LugarDePresentacion), "Atención", MessageBoxButtons.OKCancel) !=
                            DialogResult.OK)
                        {
                            return;
                        }
                    }
                }

                if (SalvarActividad())
                {
                    XtraMessageBox.Show(this, "Datos salvados correctamente", "Exitoso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    AIsAnUpdate = true;
                }
                else
                {
                    MessageBox.Show("Error salvando los datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Compruebe entrada de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Ejemplo n.º 30
0
        //public OrdenDeTrabajo _ActividadPendienteActualizar;


        public EditOtXtraForm(Enumerados.TipoActividad tipoActividad)
        {
            ATipoDeActividad = tipoActividad;
            AIsAnUpdate      = false;
            InitializeComponent();

            try
            {
                SplashScreenManager.ShowForm(MdiParent, typeof(WaitForm1), true, true);
            }
            catch (Exception)
            {
                SplashScreenManager.CloseForm();
                SplashScreenManager.ShowForm(MdiParent, typeof(WaitForm1), true, true);
            }
            PopulaControles();
            AcomodaSegunTipoActividad();
            this.DialogResult = DialogResult.OK;
            var ultimaOrden = OrdenDeTrabajo.GetUltimaActividad(ATipoDeActividad);

            FechaConfecciontimeEdit.DateTime            = DateTime.Today;
            FechaConfecciontimeEdit.Properties.MinValue = fechaIncialActividadDateEdit.Properties.MinValue = fechaFinalActividadDateEdit.Properties.MinValue = ultimaOrden != null?ultimaOrden.FechaConfeccion:DateTime.Today;
        }