public bool AnularDB(fa_cliente_x_ct_centro_costo_Info info, ref string mensaje)
 {
     try
     {
         using (Entity_Facturacion_FJ Base = new Entity_Facturacion_FJ())
         {
             var address = Base.fa_cliente_x_ct_centro_costo.FirstOrDefault(o => o.IdCliente_cli == info.IdCliente_cli && o.IdCentroCosto_cc == info.IdCentroCosto_cc);
             if (address != null)
             {
                 address.IdCliente_cli    = info.IdCliente_cli;
                 address.IdEmpresa_cc     = info.IdEmpresa_cc;
                 address.IdEmpresa_cli    = info.IdEmpresa_cli;
                 address.IdCentroCosto_cc = info.IdCentroCosto_cc;
                 address.Observacion      = info.Observacion;
                 Base.SaveChanges();
                 mensaje = "Se guardo exitosamente.";
             }
             return(true);
         }
     }
     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);
         mensaje = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Exemplo n.º 2
0
        private void Iniciar_treelist()
        {
            try
            {
                TreeListNode nodeTodos;
                TreeListNode nodeCliente;
                lst_Cliente_x_Centro_costo = bus_Cliente_x_Centro_costo.Get_Vista_Clientes_x_Centro_costo(param.IdEmpresa);
                if (lst_Cliente_x_Centro_costo.Count != 0)
                {
                    tlClientes.BeginUnboundLoad();
                    fa_cliente_x_ct_centro_costo_Info info = new fa_cliente_x_ct_centro_costo_Info();
                    info.nom_Cliente = "Todos";

                    nodeTodos             = tlClientes.AppendNode(new object[] { info.nom_Cliente, info }, null);
                    nodeTodos.HasChildren = true;
                    nodeTodos.Tag         = info;
                    foreach (var item in lst_Cliente_x_Centro_costo)
                    {
                        nodeCliente             = tlClientes.AppendNode(new object[] { item.nom_Cliente, item }, nodeTodos);
                        nodeCliente.HasChildren = false;
                        nodeCliente.Tag         = item;
                    }
                    tlClientes.ExpandAll();
                    tlClientes.EndUnboundLoad();
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
 public bool Grabar(fa_cliente_x_ct_centro_costo_Info info, ref string mensaje)
 {
     try
     {
         using (Entity_Facturacion_FJ Base = new Entity_Facturacion_FJ())
         {
             fa_cliente_x_ct_centro_costo address = new fa_cliente_x_ct_centro_costo();
             address.IdCliente_cli    = info.IdCliente_cli;
             address.IdEmpresa_cc     = info.IdEmpresa_cc;
             address.IdEmpresa_cli    = info.IdEmpresa_cli;
             address.IdCentroCosto_cc = info.IdCentroCosto_cc;
             address.Observacion      = info.Observacion;
             Base.fa_cliente_x_ct_centro_costo.Add(address);
             Base.SaveChanges();
             mensaje = "Se ha guardado exitosamente ";
         }
         return(true);
     }
     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);
         mensaje = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
        private void cmb_Centro_costo_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmb_Centro_costo.EditValue != null)
                {
                    string idCentro_costo = cmb_Centro_costo.EditValue.ToString();
                    info_Centro_costo = list_Centro_costo.FirstOrDefault(q => q.IdCentroCosto == idCentro_costo && q.IdEmpresa == param.IdEmpresa);
                    if (info_Centro_costo != null)
                    {
                        list_Centro_costo_sub_centro_costo = bus_Centro_costo_sub_centro_costo.Get_list_centro_costo_sub_centro_costo(info_Centro_costo.IdEmpresa, info_Centro_costo.IdCentroCosto);
                    }
                    else
                    {
                        list_Centro_costo_sub_centro_costo = new List <ct_centro_costo_sub_centro_costo_Info>();
                    }
                    cmb_Sub_centro_costo.Properties.DataSource    = list_Centro_costo_sub_centro_costo;
                    cmb_Sub_centro_costo.Properties.ValueMember   = "IdCentroCosto_sub_centro_costo";
                    cmb_Sub_centro_costo.Properties.DisplayMember = "Centro_costo2";
                }
                else
                {
                    info_Centro_costo = null;
                    cmb_Sub_centro_costo.EditValue                = null;
                    list_Centro_costo_sub_centro_costo            = new List <ct_centro_costo_sub_centro_costo_Info>();
                    cmb_Sub_centro_costo.Properties.DataSource    = list_Centro_costo_sub_centro_costo;
                    cmb_Sub_centro_costo.Properties.ValueMember   = "IdCentroCosto_sub_centro_costo";
                    cmb_Sub_centro_costo.Properties.DisplayMember = "Centro_costo2";
                }


                if (foco_Centro_costo)
                {
                    if (info_Centro_costo != null)
                    {
                        info_Cliente_x_centro_costo = list_Cliente_x_Centro_costo.FirstOrDefault(q => q.IdCentroCosto_cc == info_Centro_costo.IdCentroCosto);
                        if (info_Cliente_x_centro_costo != null)
                        {
                            cmb_Cliente.EditValue = info_Cliente_x_centro_costo.IdCliente_cli;
                        }
                        else
                        {
                            cmb_Cliente.EditValue = null;
                        }
                    }
                    else
                    {
                        cmb_Cliente.EditValue = null;
                    }
                }
                event_delegate_cmb_Centro_costo_EditValueChanged(sender, e);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Exemplo n.º 5
0
 public Boolean AnularDB(fa_cliente_x_ct_centro_costo_Info info, ref string mensaje)
 {
     try
     {
         return(data.AnularDB(info, ref mensaje));
     }
     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("", "ModificarBD", ex.Message), ex)
               {
                   EntityType = typeof(fa_cliente_x_ct_centro_costo_Bus)
               };
     }
 }
Exemplo n.º 6
0
 private void tlClientes_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
 {
     try
     {
         info_Cliente_x_Centro_costo = e.Node.Tag as fa_cliente_x_ct_centro_costo_Info;
         if (info_Cliente_x_Centro_costo != null)
         {
             Filtrar_grillas();
         }
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
Exemplo n.º 7
0
        Boolean Guardar()
        {
            try
            {
                Boolean Res = false;
                get_info();
                Info_centro_costo.Fecha_Transac = DateTime.Now;
                Info_centro_costo.IdUsuario     = param.IdUsuario;
                Res = Centro_costo_Bus.GrabarDB(Info_centro_costo, ref MensajeError);
                if (Res)
                {
                    //Guardar en tabla intermedia
                    Cl_x_cc_Info = new fa_cliente_x_ct_centro_costo_Info();
                    get_info_CentroCosto_x_Cliente();
                    if (Cl_x_cc_Info.IdCliente_cli != 0)
                    {
                        Res = Cl_x_cc_Bus.GrabarBD(Cl_x_cc_Info, ref MensajeError);
                    }

                    MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Se_guardaron_los_datos_correctamente), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ucGe_Menu.Visible_btnGuardar         = true;
                    ucGe_Menu.Visible_bntGuardar_y_Salir = true;
                    cmbCliente.EditValue = "[Vacio]";
                    limpiarFj();
                    _Accion         = Cl_Enumeradores.eTipo_action.grabar;
                    txt_codigo.Text = Centro_costo_Bus.Get_IdCentroCosto_x_Raiz(param.IdEmpresa, ref MensajeError);
                }
                else
                {
                    string smensaje = string.Format(Core.Erp.Recursos.Properties.Resources.msgError_Grabar);
                    MessageBox.Show(MensajeError + " " + smensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return(true);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        private void cmb_Cliente_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmb_Cliente.EditValue != null)
                {
                    decimal idCliente = Convert.ToDecimal(cmb_Cliente.EditValue);
                    info_Cliente = bus_Cliente.Get_Info_Cliente(param.IdEmpresa, idCliente);
                    info_Cliente_x_centro_costo = list_Cliente_x_Centro_costo.FirstOrDefault(q => q.IdEmpresa_cli == info_Cliente.IdEmpresa && q.IdCliente_cli == idCliente);
                }
                else
                {
                    info_Cliente = null;
                    info_Cliente_x_centro_costo = null;
                }

                if (foco_Cliente)
                {
                    if (cmb_Cliente.EditValue != null)
                    {
                        if (info_Cliente_x_centro_costo != null)
                        {
                            cmb_Centro_costo.EditValue = info_Cliente_x_centro_costo.IdCentroCosto_cc;
                        }
                        else
                        {
                            cmb_Centro_costo.EditValue = null;
                        }
                    }
                    else
                    {
                        cmb_Centro_costo.EditValue = null;
                    }
                }
                event_delegate_cmb_Cliente_EditValueChanged(sender, e);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Exemplo n.º 9
0
        Boolean Actualizar()
        {
            try
            {
                Boolean Res = false;
                Info_centro_costo.Fecha_UltMod    = DateTime.Now;
                Info_centro_costo.IdUsuarioUltMod = param.IdUsuario;
                Res = Centro_costo_Bus.ModificarDB(Info_centro_costo, ref MensajeError);
                if (Res)
                {
                    Cl_x_cc_Info = new fa_cliente_x_ct_centro_costo_Info();
                    get_info_CentroCosto_x_Cliente();
                    if (Cl_x_cc_Info.IdCliente_cli != 0)
                    {
                        Res = Cl_x_cc_Bus.ModificarBD(Cl_x_cc_Info, ref MensajeError);
                    }
                    MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Se_modifico_corrrectamente), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ucGe_Menu.Visible_btnGuardar         = true;
                    ucGe_Menu.Visible_bntGuardar_y_Salir = true;
                    cmbCliente.EditValue = "[Vacio]";
                    limpiarFj();
                }
                else
                {
                    string smensaje = string.Format(Core.Erp.Recursos.Properties.Resources.msgError_Modificar);
                    MessageBox.Show(smensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return(Res);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        public List <fa_cliente_x_ct_centro_costo_Info> Get_Vista_Clientes_x_Centro_costo(int idEmpresa)
        {
            try
            {
                List <fa_cliente_x_ct_centro_costo_Info> Lista = new List <fa_cliente_x_ct_centro_costo_Info>();

                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    var lst = from q in Context.vwfa_cliente_x_ct_centro_costo
                              where q.IdEmpresa_cc == idEmpresa
                              select q;

                    foreach (var item in lst)
                    {
                        fa_cliente_x_ct_centro_costo_Info info = new fa_cliente_x_ct_centro_costo_Info();

                        info.IdEmpresa_cli    = item.IdEmpresa_cli;
                        info.IdCliente_cli    = item.IdCliente_cli;
                        info.IdEmpresa_cc     = item.IdEmpresa_cc;
                        info.IdCentroCosto_cc = item.IdCentroCosto_cc;
                        info.nom_Centro_costo = item.nom_Centro_costo;
                        info.nom_Cliente      = item.nom_Cliente;

                        Lista.Add(info);
                    }
                }

                return(Lista);
            }
            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 MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
 public fa_cliente_x_ct_centro_costo_Info Get_Info_Cliente_x_Centro_costo_x_Centro_costo()
 {
     try
     {
         if (cmb_Centro_costo.EditValue != null)
         {
             string IdCentroCosto = cmb_Centro_costo.EditValue.ToString();
             info_Cliente_x_centro_costo = list_Cliente_x_Centro_costo.FirstOrDefault(q => q.IdCentroCosto_cc == IdCentroCosto);
         }
         else
         {
             info_Cliente_x_centro_costo = null;
         }
         return(info_Cliente_x_centro_costo);
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         return(null);
     }
 }
Exemplo n.º 12
0
        private void ucGe_Menu_event_btnImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                fa_cliente_x_ct_centro_costo_Info info = new fa_cliente_x_ct_centro_costo_Info();
                info      = ucFa_Cliente.Get_Info_Cliente_x_Centro_costo();
                fee       = bus_margen_ganancia.Get_Fee(param.IdEmpresa, periodo_info.IdanioFiscal, info.IdCliente_cli);
                Idcliente = ucFa_Cliente.Get_Info_Centro_costo().IdCliente_cli;

                switch (param.IdCliente_Ven_x_Default)
                {
                case Cl_Enumeradores.eCliente_Vzen.FJ:
                    XFAC_FJ_Rpt004_Rpt Reporte4 = new XFAC_FJ_Rpt004_Rpt();
                    foreach (var item in lista_liquidaciones_gastos)
                    {
                        item.Periodo = "Periodo " + periodo_info.smes + " " + periodo_info.IdanioFiscal;;
                    }
                    Reporte4.Set(lista_liquidaciones_gastos);
                    Reporte4.CreateDocument();
                    Reporte4.ShowPreview();



                    // imprimir resume por subcentro
                    XFAC_FJ_Rpt006_Rpt reporte6 = new XFAC_FJ_Rpt006_Rpt();
                    reporte6.Parameters["IdEmpresa"].Value = param.IdEmpresa;
                    reporte6.Parameters["IdPeriodo"].Value = periodo_info.IdPeriodo;
                    reporte6.Parameters["Mes"].Value       = periodo_info.smes + " " + periodo_info.IdanioFiscal;
                    reporte6.Parameters["fee"].Value       = periodo_info.smes;

                    reporte6.CreateDocument();
                    reporte6.ShowPreview();



                    // imprimir resume por subcentro
                    XFAC_FJ_Rpt007_Rpt reporte_mo = new XFAC_FJ_Rpt007_Rpt();
                    reporte_mo.Parameters["IdEmpresa"].Value = param.IdEmpresa;
                    reporte_mo.Parameters["IdPeriodo"].Value = periodo_info.IdPeriodo;
                    reporte_mo.Parameters["Periodo"].Value   = periodo_info.smes + " " + periodo_info.IdanioFiscal;
                    reporte_mo.Parameters["fee"].Value       = periodo_info.smes;

                    reporte_mo.Parameters["Anio"].Value = periodo_info.IdanioFiscal;
                    reporte_mo.Parameters["Mes"].Value  = periodo_info.pe_mes;

                    reporte_mo.CreateDocument();
                    reporte_mo.ShowPreview();
                    break;

                case Cl_Enumeradores.eCliente_Vzen.TRANSGANDIA:

                    // imprimir mano de obra
                    XFAC_FJ_Rpt008_Rpt reporte_mo_tra = new XFAC_FJ_Rpt008_Rpt();
                    reporte_mo_tra.Parameters["IdEmpresa"].Value = param.IdEmpresa;
                    reporte_mo_tra.Parameters["IdPeriodo"].Value = periodo_info.IdPeriodo;
                    reporte_mo_tra.Parameters["Periodo"].Value   = periodo_info.smes + " " + periodo_info.IdanioFiscal;
                    reporte_mo_tra.Parameters["fee"].Value       = periodo_info.smes;

                    reporte_mo_tra.Parameters["Anio"].Value = periodo_info.IdanioFiscal;
                    reporte_mo_tra.Parameters["Mes"].Value  = periodo_info.pe_mes;

                    reporte_mo_tra.CreateDocument();
                    reporte_mo_tra.ShowPreview();


                    // imprimir depreciacion
                    XFAC_FJ_Rpt009_Rpt reporte_Depreciacion = new XFAC_FJ_Rpt009_Rpt();
                    reporte_Depreciacion.Parameters["IdEmpresa"].Value = param.IdEmpresa;
                    reporte_Depreciacion.Parameters["IdPeriodo"].Value = periodo_info.IdPeriodo;
                    reporte_Depreciacion.Parameters["Anio"].Value      = periodo_info.IdanioFiscal;
                    reporte_Depreciacion.Parameters["IdCliente"].Value = ucFa_Cliente.Get_Info_Cliente_x_Centro_costo().IdCliente_cli;
                    reporte_Depreciacion.CreateDocument();
                    reporte_Depreciacion.ShowPreview();


                    // imprimir gastos
                    XFAC_FJ_Rpt010_Rpt reporte_gasto = new XFAC_FJ_Rpt010_Rpt();
                    reporte_gasto.Parameters["IdEmpresa"].Value = param.IdEmpresa;
                    reporte_gasto.Parameters["IdPeriodo"].Value = periodo_info.IdPeriodo;
                    reporte_gasto.Parameters["Anio"].Value      = periodo_info.IdanioFiscal;
                    reporte_gasto.Parameters["IdCliente"].Value = ucFa_Cliente.Get_Info_Cliente_x_Centro_costo().IdCliente_cli;
                    reporte_gasto.CreateDocument();
                    reporte_gasto.ShowPreview();



                    XFAC_FJ_Rpt004_Rpt Reporte_liq = new XFAC_FJ_Rpt004_Rpt();
                    foreach (var item in lista_liquidaciones_gastos)
                    {
                        item.Periodo = "Periodo " + periodo_info.smes + " " + periodo_info.IdanioFiscal;;
                    }
                    Reporte_liq.Set(lista_liquidaciones_gastos);
                    Reporte_liq.CreateDocument();
                    Reporte_liq.ShowPreview();



                    // impremision de tabla de amortizacion
                    XFAC_FJ_Rpt012_Rpt Reporte_Interes = new XFAC_FJ_Rpt012_Rpt();
                    Reporte_Interes.Parameters["IdEmpresa"].Value = param.IdEmpresa;
                    Reporte_Interes.Parameters["IdPeriodo"].Value = periodo_info.IdPeriodo;

                    Reporte_Interes.CreateDocument();
                    Reporte_Interes.ShowPreview();


                    // impresion de seguro
                    XFAC_FJ_Rpt013_Rpt Reporte_Seguro = new XFAC_FJ_Rpt013_Rpt();
                    Reporte_Seguro.Parameters["IdEmpresa"].Value     = param.IdEmpresa;
                    Reporte_Seguro.Parameters["IdPeriodo"].Value     = periodo_info.IdPeriodo;
                    Reporte_Seguro.Parameters["IdCentroCosto"].Value = ucFa_Cliente.Get_Info_Centro_costo().IdCentroCosto;

                    Reporte_Seguro.CreateDocument();
                    Reporte_Seguro.ShowPreview();


                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }