Exemplo n.º 1
0
 private void btnAprobar_Click(object sender, EventArgs e)
 {
     try
     {
         txtIdCotizacion.Focus();
         gv_detalle.MoveNext();
         if (info.ListaDetalle.Count == 0)
         {
             MessageBox.Show("No se ha cargado el detalle correctamente, vuelva a consultar la cotización", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             return;
         }
         info.ListaDetalle   = new List <com_CotizacionPedidoDet_Info>(blst);
         info.cp_Observacion = txtObservacion.Text;
         info.IdUsuario      = param.IdUsuario;
         info.EstadoJC       = info.ListaDetalle.Where(q => q.A == true).Count() > 0 ? "A" : "R";
         if (info.ListaDetalle.Where(q => q.A == false).Count() == info.ListaDetalle.Count())
         {
             info.EstadoJC = "R";
         }
         if (bus_cotizacion.AprobarDB(info, "JC"))
         {
             CargarCotizacion();
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 2
0
        private void uc_menu_event_btnAprobarGuardarSalir_Click(object sender, EventArgs e)
        {
            try
            {
                txt_codigo.Focus();
                if (blst.Where(q => q.opd_EstadoProceso != "AJC").Count() > 0)
                {
                    MessageBox.Show("Para aprobar el pedido todos los items deben ser aprobados por el jefe de compras", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                var lst = blst.GroupBy(q => q.IdCotizacion).ToList();
                foreach (var item in lst)
                {
                    var cotizacion = bus_cotizacion.GetInfoAprobar(param.IdEmpresa, item.Key);
                    if (cotizacion != null)
                    {
                        cotizacion.ObservacionAprobador = txt_ObservacionApro.Text;
                        cotizacion.EstadoGA             = blst.Where(q => q.IdCotizacion == item.Key && q.A == true).Count() > 0 ? "A" : "R";
                        cotizacion.IdUsuario            = param.IdUsuario;
                        cotizacion.ListaDetalle         = new List <com_CotizacionPedidoDet_Info>(blst.Where(q => q.IdCotizacion == item.Key).Select(q => new com_CotizacionPedidoDet_Info
                        {
                            IdEmpresa         = param.IdEmpresa,
                            IdCotizacion      = q.IdCotizacion,
                            Secuencia         = q.Secuencia,
                            opd_IdEmpresa     = q.opd_IdEmpresa,
                            opd_IdOrdenPedido = q.opd_IdOrdenPedido,
                            opd_Secuencia     = q.opd_Secuencia,
                            IdProducto        = q.IdProducto ?? 0,
                            cd_Cantidad       = q.cd_Cantidad,
                            cd_precioCompra   = q.cd_precioCompra,
                            cd_porc_des       = q.cd_porc_des,
                            cd_descuento      = q.cd_descuento,
                            cd_precioFinal    = q.cd_precioFinal,
                            cd_subtotal       = q.cd_subtotal,
                            IdCod_Impuesto    = q.IdCod_Impuesto,
                            Por_Iva           = q.Por_Iva,
                            cd_iva            = q.cd_iva,
                            cd_total          = q.cd_total,
                            IdUnidadMedida    = q.IdUnidadMedida,
                            IdPunto_cargo     = q.IdPunto_cargo,
                            EstadoGA          = q.A,
                            A = q.A,
                            cd_DetallePorItem = q.cd_DetallePorItem,
                            IdSucursalDestino = q.IdSucursalDestino,
                            opd_Detalle       = q.opd_Detalle
                        }).ToList());

                        if (!bus_cotizacion.AprobarDB(cotizacion, "GA"))
                        {
                            return;
                        }
                    }
                }
                bus_pedido.ValidarProceso(param.IdEmpresa, IdOrdenPedido);
                MessageBox.Show("Pedido # " + txt_IdOrdenPedido.Text + " actualizado exitósamente", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.Close();
            }
            catch (Exception)
            {
            }
        }