Ejemplo n.º 1
0
 public List<cp_Aprobacion_Ing_Bod_x_OC_det_Info> Get_List_Aprobacion_Ing_Bod_x_OC_det(int IdEmpresa, decimal IdAprobacion)
 {
     List<cp_Aprobacion_Ing_Bod_x_OC_det_Info> Lst = new List<cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
     EntitiesCuentasxPagar OECxP = new EntitiesCuentasxPagar();
     try
     {
                                
         var Query = from q in OECxP.vwcp_Aprobacion_Ing_Bod_x_OC_det
                     where q.IdEmpresa == IdEmpresa && q.IdAprobacion== IdAprobacion                        
                     select q;
         foreach (var item in Query)
         {
             cp_Aprobacion_Ing_Bod_x_OC_det_Info Obj = new cp_Aprobacion_Ing_Bod_x_OC_det_Info();
     
             Obj.IdEmpresa = item.IdEmpresa;
             Obj.IdAprobacion = item.IdAprobacion;
             Obj.Secuencia =item.Secuencia;
             Obj.IdEmpresa_Ing_Egr_Inv = item.IdEmpresa_Ing_Egr_Inv;
             Obj.IdSucursal_Ing_Egr_Inv = item.IdSucursal_Ing_Egr_Inv;
             Obj.IdMovi_inven_tipo_Ing_Egr_Inv = item.IdMovi_inven_tipo_Ing_Egr_Inv;
             Obj.IdNumMovi_Ing_Egr_Inv = item.IdNumMovi_Ing_Egr_Inv;
             Obj.Secuencia_Ing_Egr_Inv = item.Secuencia_Ing_Egr_Inv;
             Obj.Cantidad = item.Cantidad;
             Obj.Costo_uni = item.Costo_uni;
             Obj.Descuento = item.Descuento;
             Obj.SubTotal = item.SubTotal;
             Obj.PorIva = item.PorIva;
             Obj.valor_Iva = item.valor_Iva;
             Obj.Total = item.Total;
             Obj.IdCtaCble_Gasto = item.IdCtaCble_Gasto;
             Obj.IdCtaCble_IVA = item.IdCtaCble_IVA;
             Obj.IdCentro_Costo = item.IdCentro_Costo_x_Gasto_x_cxp;
             Obj.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo_cxp;
             Obj.IdSucursal_OC = item.IdSucursal_Ing_Egr_Inv;
             Obj.nom_sucursal = item.nom_sucursal;
             Obj.IdCod_Impuesto_Iva = item.IdCod_Impuesto_Iva;
             Obj.por_descuento = item.por_descuento == null ? 0 : Convert.ToDouble(item.por_descuento);
             Obj.Cost_uni_final = item.Cost_uni_final == null ? 0 : Convert.ToDouble(item.Cost_uni_final);
             Obj.IdProducto = item.IdProducto;
             Lst.Add(Obj);
         }
         return Lst;
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                             "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.InnerException + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Ejemplo n.º 2
0
        public List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Get_List_Ing_Bod_x_OC_Conciliadas(int IdEmpresa, decimal IdConciliacion)
        {
            try
            {
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Lst = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
                EntitiesCuentasxPagar oEnti = new EntitiesCuentasxPagar();

                var Query = from q in oEnti.vwcp_Orden_Giro_Conciliado_x_Ing_Bod_x_OC
                            where q.IdEmpresa == IdEmpresa &&
                            q.IdConciliacion == IdConciliacion

                            select q;

                foreach (var item in Query)
                {
                    cp_Aprobacion_Ing_Bod_x_OC_det_Info Obj = new cp_Aprobacion_Ing_Bod_x_OC_det_Info();
                    Obj.IdEmpresa_Ing_Egr_Inv  = item.IdEmpresa;
                    Obj.IdSucursal_Ing_Egr_Inv = item.IdSucursal_Ing_Egr_Inv;
                    Obj.IdNumMovi_Ing_Egr_Inv  = item.IdNumMovi_Ing_Egr_Inv;
                    Obj.Secuencia_Ing_Egr_Inv  = item.Secuencia_Ing_Egr_Inv;
                    Obj.IdBodega       = item.IdBodega;
                    Obj.Fecha_Ing_Bod  = Convert.ToDateTime(item.Fecha_Ing_Bod);
                    Obj.IdProducto     = item.IdProducto;
                    Obj.nom_producto   = item.nom_producto;
                    Obj.IdUnidadMedida = item.IdUnidadMedida;
                    Obj.nom_medida     = item.nom_medida;
                    Obj.nom_bodega     = item.nom_bodega;
                    Obj.nom_sucursal   = item.nom_sucursal;
                    Obj.Cantidad       = item.Cantidad;
                    Obj.Costo_uni      = item.Costo_uni;
                    Obj.do_porc_des    = item.do_porc_des;

                    //Obj.do_ManejaIva = item.do_ManejaIva;//
                    Obj.IdProveedor   = item.IdProveedor;
                    Obj.nom_proveedor = item.pr_nombre;
                    Obj.Checked       = true;
                    Obj.IdOrdenCompra = Convert.ToDecimal(item.IdOrdenCompra);
                    Lst.Add(Obj);
                }
                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        private List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> GetDetalle(string IdCtaCble_Gasto, string IdCtaCble_IVA)
        {
            try
            {
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> lista = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();

                int focus = gridViewIngresoBodega.FocusedRowHandle;
                gridViewIngresoBodega.FocusedRowHandle = focus + 1;

                foreach (var item in list_Aprob)
                {
                    cp_Aprobacion_Ing_Bod_x_OC_det_Info info = new cp_Aprobacion_Ing_Bod_x_OC_det_Info();

                    if (item.Checked == true)
                    {
                        info.IdEmpresa_Ing_Egr_Inv         = item.IdEmpresa_Ing_Egr_Inv;
                        info.IdSucursal_Ing_Egr_Inv        = item.IdSucursal_Ing_Egr_Inv;
                        info.IdNumMovi_Ing_Egr_Inv         = item.IdNumMovi_Ing_Egr_Inv;
                        info.IdMovi_inven_tipo_Ing_Egr_Inv = item.IdMovi_inven_tipo_Ing_Egr_Inv;
                        info.Secuencia_Ing_Egr_Inv         = item.Secuencia_Ing_Egr_Inv;

                        info.IdSucursal_OC = item.IdSucursal_OC;
                        info.IdOrdenCompra = item.IdOrdenCompra;
                        info.Secuencia_OC  = item.Secuencia_OC;

                        info.Cantidad        = item.Cantidad;
                        info.Costo_uni       = item.Costo_uni;
                        info.Descuento       = item.Descuento;
                        info.SubTotal        = item.SubTotal;
                        info.PorIva          = item.PorIva;
                        info.valor_Iva       = item.valor_Iva;
                        info.Total           = item.Total;
                        info.IdCtaCble_Gasto = IdCtaCble_Gasto;
                        info.IdCtaCble_IVA   = IdCtaCble_IVA;

                        lista.Add(info);
                    }
                }

                return(lista);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>());
            }
        }
        public List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> get_OG_x_Cta_Cble(List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> lstDet_OG)
        {
            try
            {
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> lstDet_OG_Agrupado = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();

                var select = from ing_ in lstDet_OG
                             group ing_ by new
                {
                    ing_.IdCtaCble_Gasto,
                    IdCentro_Costo_x_Gasto_x_cxp       = ing_.IdCentro_Costo,
                    IdCentroCosto_sub_centro_costo_cxp = ing_.IdCentroCosto_sub_centro_costo,
                    IdPunto_cargo_grupo = ing_.IdPunto_cargo_grupo,
                    IdPunto_cargo       = ing_.IdPunto_cargo
                }
                into grouping
                    select new
                {
                    grouping.Key,
                    Total    = grouping.Sum(q => q.Total),
                    Subtotal = grouping.Sum(q => q.SubTotal)
                };

                foreach (var item in select)
                {
                    cp_Aprobacion_Ing_Bod_x_OC_det_Info info = new cp_Aprobacion_Ing_Bod_x_OC_det_Info();
                    info.IdCtaCble_Gasto = item.Key.IdCtaCble_Gasto;
                    info.IdCentro_Costo  = item.Key.IdCentro_Costo_x_Gasto_x_cxp;
                    info.IdCentroCosto_sub_centro_costo = item.Key.IdCentroCosto_sub_centro_costo_cxp;
                    info.IdPunto_cargo_grupo            = item.Key.IdPunto_cargo_grupo;
                    info.IdPunto_cargo = item.Key.IdPunto_cargo;
                    info.Total         = item.Total;
                    info.SubTotal      = item.Subtotal;
                    lstDet_OG_Agrupado.Add(info);
                }
                return(lstDet_OG_Agrupado);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_List_cancelacion_Intercompany", ex.Message), ex)
                      {
                          EntityType = typeof(cp_Aprobacion_Ing_Bod_x_OC_Bus)
                      };
            }
        }
Ejemplo n.º 5
0
        public List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Get_List_Aprobacion_Ing_Bod_x_OC_det_x_Proveedor(int IdEmpresa, decimal IdProveedor)
        {
            try
            {
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Lst = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
                EntitiesInventario oEnti = new EntitiesInventario();

                var Query = from q in oEnti.vwin_Ing_Egr_Inven_det_x_com_ordencompra_local_det_x_cp_Aprobacion_Ing_Bod_x_OC_det
                            where q.IdEmpresa == IdEmpresa &&
                            q.IdProveedor == IdProveedor
                            select q;

                foreach (var item in Query)
                {
                    cp_Aprobacion_Ing_Bod_x_OC_det_Info Obj = new cp_Aprobacion_Ing_Bod_x_OC_det_Info();

                    Obj.IdEmpresa_Ing_Egr_Inv         = item.IdEmpresa;
                    Obj.IdSucursal_Ing_Egr_Inv        = item.IdSucursal;
                    Obj.IdMovi_inven_tipo_Ing_Egr_Inv = Convert.ToInt32(item.IdMovi_inven_tipo);
                    Obj.IdNumMovi_Ing_Egr_Inv         = item.IdNumMovi;
                    Obj.Secuencia_Ing_Egr_Inv         = item.Secuencia;
                    Obj.IdBodega       = item.IdBodega;
                    Obj.Fecha_Ing_Bod  = (item.cm_fecha == null) ? DateTime.Now : Convert.ToDateTime(item.cm_fecha);
                    Obj.IdProducto     = item.IdProducto;
                    Obj.nom_producto   = item.nom_producto;
                    Obj.IdUnidadMedida = item.IdUnidadMedida;
                    Obj.nom_medida     = item.nom_medida;
                    Obj.nom_bodega     = item.nom_bodega;
                    Obj.nom_sucursal   = item.nom_sucursal;
                    Obj.Cantidad       = item.dm_cantidad;
                    Obj.Costo_uni      = Convert.ToDouble((item.mv_costo == null)?0: item.mv_costo);
                    Obj.do_porc_des    = item.do_porc_des;
                    Obj.PorIva         = item.Por_Iva;
                    Obj.IdProveedor    = item.IdProveedor;
                    Obj.nom_proveedor  = item.nom_proveedor;
                    Obj.PorIva         = item.Por_Iva;

                    ein_Inventario_O_Consumo Tipo_Inve_o_Consu;

                    try
                    {
                        Tipo_Inve_o_Consu = (ein_Inventario_O_Consumo)Enum.Parse(typeof(ein_Inventario_O_Consumo), item.es_Inven_o_Consumo);
                    }
                    catch (Exception ex)
                    {
                        Tipo_Inve_o_Consu = ein_Inventario_O_Consumo.TIC_INVEN;
                    }

                    Obj.S_es_Inven_o_Consumo = item.es_Inven_o_Consumo;
                    Obj.es_Inven_o_Consumo   = Tipo_Inve_o_Consu;


                    Obj.IdCtaCtble_Gasto_x_cxp_x_Produc = item.IdCtaCtble_Gasto_x_cxp_x_Produc;
                    Obj.IdCtaCble_Inven_x_Produc        = item.IdCtaCble_Inven_x_Produc;
                    Obj.IdCtaCtble_Inve_x_Bodega        = item.IdCtaCtble_Inve_x_Bodega;
                    Obj.IdCtaCble_Inven_x_Motivo        = item.IdCtaCble_Inven_x_Motivo;
                    Obj.IdCtaCble_Costo_x_Motivo        = item.IdCtaCble_Costo_x_Motivo;
                    //Campos para contabilizacion de Naturisa
                    Obj.IdCategoria = item.IdCategoria;
                    Obj.IdLinea     = item.IdLinea;
                    Obj.IdGrupo     = item.IdGrupo;
                    Obj.IdSubGrupo  = item.IdSubGrupo;
                    //Campos para el diario de gastos
                    Obj.IdCentro_Costo = item.IdCentroCosto;
                    Obj.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo;
                    Obj.IdPunto_cargo_grupo            = item.IdPunto_cargo_grupo;
                    Obj.IdPunto_cargo = item.IdPunto_cargo;

                    Obj.Secuencia_OC  = item.Secuencia_oc == null ? 1 : (int)item.Secuencia_oc;
                    Obj.IdSucursal_OC = item.IdSucursal_oc == null ? 1 : (int)item.IdSucursal_oc;
                    Obj.IdOrdenCompra = Convert.ToDecimal(item.IdOrdenCompra);
                    Obj.Dias          = item.Dias;
                    Lst.Add(Obj);
                }

                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Ejemplo n.º 6
0
        private void gridView_aprobacion_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                cp_Aprobacion_Ing_Bod_x_OC_det_Info row = (cp_Aprobacion_Ing_Bod_x_OC_det_Info)gridView_aprobacion.GetRow(e.RowHandle);
                if (row == null)
                {
                    return;
                }

                if (e.Column == col_IdProducto)
                {
                    if (row.IdProducto != null)
                    {
                        in_Producto_Info row_producto = lst_producto.FirstOrDefault(q => q.IdProducto == Convert.ToDecimal(row.IdProducto));
                        if (row_producto != null)
                        {
                            row.IdUnidadMedida     = row_producto.IdUnidadMedida;
                            row.IdCod_Impuesto_Iva = row_producto.IdCod_Impuesto_Iva;
                            tb_sis_impuesto_Info row_impuesto = lst_impuesto.FirstOrDefault(q => q.IdCod_Impuesto == row.IdCod_Impuesto_Iva);
                            if (row_impuesto != null)
                            {
                                row.PorIva = row_impuesto.porcentaje;
                            }
                            row.IdCtaCble_Gasto = row_producto.IdCtaCble_Gasto_x_cxp == null ? row_producto.IdCtaCble_Costo_categoria : row_producto.IdCtaCble_Gasto_x_cxp;
                            if (row.IdCtaCble_Gasto == null)
                            {
                                MessageBox.Show("El producto seleccionado no está parametrizado contablemente", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                gridView_aprobacion.DeleteSelectedRows();
                                return;
                            }
                        }
                    }
                }

                if (e.Column == col_cantidad || e.Column == col_costo || e.Column == col_por_descuento)
                {
                    row.Descuento      = Math.Round((row.Costo_uni * row.por_descuento) / 100, 2, MidpointRounding.AwayFromZero);
                    row.Cost_uni_final = Math.Round(row.Costo_uni - row.Descuento, 2, MidpointRounding.AwayFromZero);
                    row.SubTotal       = Math.Round(row.Cost_uni_final * row.Cantidad, 2, MidpointRounding.AwayFromZero);
                    row.valor_Iva      = Math.Round((row.SubTotal * row.PorIva) / 100, 2, MidpointRounding.AwayFromZero);
                    row.Total          = Math.Round(row.SubTotal + row.valor_Iva, 2, MidpointRounding.AwayFromZero);
                }

                if (e.Column == col_impuesto)
                {
                    tb_sis_impuesto_Info row_impuesto = lst_impuesto.FirstOrDefault(q => q.IdCod_Impuesto == row.IdCod_Impuesto_Iva);
                    if (row_impuesto != null)
                    {
                        row.PorIva = row_impuesto.porcentaje;
                    }
                    row.SubTotal  = Math.Round(row.Cost_uni_final * row.Cantidad, 2, MidpointRounding.AwayFromZero);
                    row.valor_Iva = Math.Round((row.SubTotal * row.PorIva) / 100, 2, MidpointRounding.AwayFromZero);
                    row.Total     = Math.Round(row.SubTotal + row.valor_Iva, 2, MidpointRounding.AwayFromZero);
                }
                calcular_totales();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }