Beispiel #1
0
 private void btn_fin_Click(Object sender, EventArgs e)  //Handles btn_fin.Click
 {
     if (lista_castigar.Rows.Count > 0)
     {
         DialogResult elige;
         elige = P.Mensaje.Confirmar("Está seguro que desea procesar los artículos de la lista de castigos?");
         if (elige == DialogResult.Yes)
         {
             var respuesta = new PD.RespuestaAccion();
             foreach (DataGridViewRow fila in lista_castigar.Rows)
             {
                 if (fila.DefaultCellStyle.BackColor != StatusColor.AFNok)
                 {
                     //las celdas que estuvieran ok no se procesan
                     fila.DefaultCellStyle.BackColor = StatusColor.AFNprocess;
                     lista_castigar.Refresh();
                     BajasDisplay data = (BajasDisplay)fila.DataBoundItem;
                     //recordset = base.CASTIGO(codigo_articulo, parte_articulo, newfecha, newcantidad, procT, form_welcome.GetUsuario, TotalDetalleLote, codigo_grupo)
                     respuesta = P.Consultas.movimientos.castigo_act(data.codigo_articulo, data.parte, data.fecha_proceso, data.cantidad_baja, P.Auxiliar.getUser(), data.detalle);
                     if (respuesta.codigo < 0)
                     {
                         //se produjo un error al momento de generar al castigo en la base de datos
                         fila.DefaultCellStyle.BackColor = StatusColor.AFNfail;
                         lista_castigar.Refresh();
                         string vbCrLf = " ";
                         P.Mensaje.Error(respuesta.descripcion + vbCrLf + "Fila: " + fila.Index.ToString());
                         return;
                     }
                     else
                     {
                         fila.DefaultCellStyle.BackColor = StatusColor.AFNok;
                         lista_castigar.Refresh();
                     }
                 }
                 Application.DoEvents();
             }
             respuesta = null;
             P.Mensaje.Info("Castigo se ha realizado con exito");
             this.Close();
         }
     }
     else
     {
         P.Mensaje.Info("No ha agregado ningun articulo al listado de castigo");
     }
 }
Beispiel #2
0
            public static PD.RespuestaAccion MODIFICA_IFRS(int batch_id, decimal valor_residual, int vida_util, int metod_val, decimal[] preparacion, decimal[] transporte, decimal[] montaje, decimal[] desmantelamiento, decimal[] honorarios)
            {
                var result = new PD.RespuestaAccion();

                try
                {
                    using (var cServ = new ServiceProcess.ServiceAFN2())
                    {
                        var parte_id     = cServ.Repo.Partes.ByLotePart(batch_id, 0).id;
                        var IFRS_systems = cServ.Repo.sistemas.IFRS();
                        var HeadId       = cServ.Repo.cabeceras.ByParteFirst(parte_id).id;
                        //metod_val
                        result = cServ.Repo.MODIF_PURCHASE_HEAD_MethodVal(HeadId, metod_val);


                        foreach (var currSystem in IFRS_systems)
                        {
                            int index = ((currSystem.CURRENCY == "CLP")?0:1);

                            PD.SV_PARAMETER CurrParam;
                            //valor_residual
                            CurrParam = cServ.Repo.parametros.ValorResidual;
                            if (valor_residual == 0)
                            {
                                result = cServ.Repo.DELETE_PURCHASE_PARAM(HeadId, currSystem, CurrParam);
                            }
                            else
                            {
                                result = cServ.Repo.MODIF_PURCHASE_PARAM(HeadId, currSystem, CurrParam, valor_residual, false);
                            }
                            if (result.codigo < 0)
                            {
                                return(result);
                            }
                            //vida_util
                            CurrParam = cServ.Repo.parametros.VidaUtil;
                            if (vida_util == 0)
                            {
                                result = cServ.Repo.DELETE_PURCHASE_PARAM(HeadId, currSystem, CurrParam);
                            }
                            else
                            {
                                result = cServ.Repo.MODIF_PURCHASE_PARAM(HeadId, currSystem, CurrParam, vida_util, false);
                            }
                            if (result.codigo < 0)
                            {
                                return(result);
                            }
                            //decimal valor_procesar;
                            //preparacion
                            CurrParam = cServ.Repo.parametros.Preparacion;

                            if (preparacion[index] == 0)
                            {
                                result = cServ.Repo.DELETE_PURCHASE_PARAM(HeadId, currSystem, CurrParam);
                            }
                            else
                            {
                                result = cServ.Repo.MODIF_PURCHASE_PARAM(HeadId, currSystem, CurrParam, preparacion[index], false);
                            }
                            if (result.codigo < 0)
                            {
                                return(result);
                            }
                            //transporte
                            CurrParam = cServ.Repo.parametros.Transporte;
                            if (transporte[index] == 0)
                            {
                                result = cServ.Repo.DELETE_PURCHASE_PARAM(HeadId, currSystem, CurrParam);
                            }
                            else
                            {
                                result = cServ.Repo.MODIF_PURCHASE_PARAM(HeadId, currSystem, CurrParam, transporte[index], false);
                            }
                            if (result.codigo < 0)
                            {
                                return(result);
                            }
                            //montaje
                            CurrParam = cServ.Repo.parametros.Montaje;
                            if (montaje[index] == 0)
                            {
                                result = cServ.Repo.DELETE_PURCHASE_PARAM(HeadId, currSystem, CurrParam);
                            }
                            else
                            {
                                result = cServ.Repo.MODIF_PURCHASE_PARAM(HeadId, currSystem, CurrParam, montaje[index], false);
                            }
                            if (result.codigo < 0)
                            {
                                return(result);
                            }
                            //desmantelamiento
                            CurrParam = cServ.Repo.parametros.Desmantelamiento;
                            if (desmantelamiento[index] == 0)
                            {
                                result = cServ.Repo.DELETE_PURCHASE_PARAM(HeadId, currSystem, CurrParam);
                            }
                            else
                            {
                                result = cServ.Repo.MODIF_PURCHASE_PARAM(HeadId, currSystem, CurrParam, desmantelamiento[index], false);
                            }
                            if (result.codigo < 0)
                            {
                                return(result);
                            }
                            //honorarios
                            CurrParam = cServ.Repo.parametros.Honorario;
                            if (honorarios[index] == 0)
                            {
                                result = cServ.Repo.DELETE_PURCHASE_PARAM(HeadId, currSystem, CurrParam);
                            }
                            else
                            {
                                result = cServ.Repo.MODIF_PURCHASE_PARAM(HeadId, currSystem, CurrParam, honorarios[index], false);
                            }
                            if (result.codigo < 0)
                            {
                                return(result);
                            }
                        }
                    }
                    result.set_ok();
                }
                catch (Exception ex)
                {
                    result.set(-1, ex.StackTrace);
                }

                return(result);
            }