public Boolean GuardarDB(fa_notaCreDeb_x_cxc_cobro_Info Item, ref string mensaje)
        {
            try
            {
                using (EntitiesFacturacion oEnti = new EntitiesFacturacion())
                {
                    fa_notaCreDeb_x_cxc_cobro fa_nota = new fa_notaCreDeb_x_cxc_cobro();

                    fa_nota.IdEmpresa_cbr  = Item.IdEmpresa_cbr;
                    fa_nota.IdSucursal_cbr = Item.IdSucursal_cbr;
                    fa_nota.IdCobro_cbr    = Item.IdCobro_cbr;
                    fa_nota.IdEmpresa_nt   = Item.IdEmpresa_nt;
                    fa_nota.IdSucursal_nt  = Item.IdSucursal_nt;
                    fa_nota.IdBodega_nt    = Item.IdBodega_nt;
                    fa_nota.IdNota_nt      = Item.IdNota_nt;
                    fa_nota.Valor_cobro    = Item.Valor_cobro;

                    oEnti.fa_notaCreDeb_x_cxc_cobro.Add(fa_nota);
                    oEnti.SaveChanges();
                }

                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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 2
0
        public fa_notaCreDeb_x_cxc_cobro_Info Get_faNotaCreDeb_x_Cobro(cxc_cobro_Info info, cxc_conciliacion_Info Item)
        {
            try
            {
                string mensaje = "";
                fa_notaCreDeb_x_cxc_cobro_Info info_NotaCreDeb = new fa_notaCreDeb_x_cxc_cobro_Info();
                cxc_conciliacion_det_Info      conciliaInfo    = new cxc_conciliacion_det_Info();
                info_NotaCreDeb.IdEmpresa_cbr  = info.IdEmpresa;
                info_NotaCreDeb.IdSucursal_cbr = info.IdSucursal;
                info_NotaCreDeb.IdCobro_cbr    = info.IdCobro;
                conciliaInfo = Item.Detalle.First();
                info_NotaCreDeb.IdEmpresa_nt  = Convert.ToInt32(conciliaInfo.IdEmpresa_nt);
                info_NotaCreDeb.IdSucursal_nt = Convert.ToInt32(conciliaInfo.IdSucursal_nt);;
                info_NotaCreDeb.IdBodega_nt   = Convert.ToInt32(conciliaInfo.IdBodega_nt);
                info_NotaCreDeb.IdNota_nt     = Convert.ToInt32(conciliaInfo.IdNota_nt);

                info_NotaCreDeb.Valor_cobro = info.cr_TotalCobro;

                return(info_NotaCreDeb);
            }
            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_faNotaCreDeb_x_Cobro", ex.Message), ex)
                      {
                          EntityType = typeof(cxc_cobro_x_EstadoCobro_Bus)
                      };
            }
        }
Exemplo n.º 3
0
 public Boolean GuardarDB(fa_notaCreDeb_x_cxc_cobro_Info Item, ref string mensaje)
 {
     try
     {
         return(oData.GuardarDB(Item, 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("", "Guardar_NotaCreDeb_x_Cobro", ex.Message), ex)
               {
                   EntityType = typeof(fa_notaCreDeb_x_cxc_cobro_Bus)
               };
     }
 }
        public fa_notaCreDeb_x_cxc_cobro_Info Get_info_cobro_x_nc(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdNota)
        {
            try
            {
                fa_notaCreDeb_x_cxc_cobro_Info info = new fa_notaCreDeb_x_cxc_cobro_Info();

                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    var lst = from q in context.fa_notaCreDeb_x_cxc_cobro
                              where q.IdEmpresa_nt == IdEmpresa &&
                              q.IdSucursal_nt == IdSucursal &&
                              q.IdBodega_nt == IdBodega &&
                              q.IdNota_nt == IdNota
                              select q;

                    foreach (var item in lst)
                    {
                        info.IdEmpresa_cbr  = item.IdEmpresa_cbr;
                        info.IdSucursal_cbr = item.IdSucursal_cbr;
                        info.IdCobro_cbr    = item.IdCobro_cbr;
                        info.IdEmpresa_nt   = item.IdEmpresa_nt;
                        info.IdSucursal_nt  = item.IdSucursal_nt;
                        info.IdBodega_nt    = item.IdBodega_nt;
                        info.IdNota_nt      = item.IdNota_nt;
                        info.Valor_cobro    = item.Valor_cobro;
                    }
                }

                return(info);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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();
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 5
0
        public Boolean GuardarDB(cxc_conciliacion_Info Item, ct_Cbtecble_Info CbteCbleInfo, Cl_Enumeradores.TipoConciliacion TipoConciliacion, ref decimal Id, ref string mensaje)
        {
            string mensajeError = "";

            try
            {
                cxc_cobro_Info                 CobrosInfo       = new cxc_cobro_Info();
                cxc_cobro_Det_Info             CobroDetalleInfo = new cxc_cobro_Det_Info();
                List <cxc_cobro_Det_Info>      lstCobDetInfo    = new List <cxc_cobro_Det_Info>();
                fa_notaCreDeb_x_cxc_cobro_Info info_NotaCreDeb  = new fa_notaCreDeb_x_cxc_cobro_Info();
                decimal IdCobroDet  = 0;
                Boolean resultCobro = true;
                oData.Guardar_Conciliacion(Item, ref Id, ref mensaje);
                decimal idConciliacion = Id;

                //si es por anticipo solo inserto el detalle del cobro
                if (Cl_Enumeradores.TipoConciliacion.ANT_CLI == TipoConciliacion)
                {
                    ct_Cbtecble_Bus CbteCbleBus = new ct_Cbtecble_Bus();
                    string          codCbteCble = "";
                    decimal         idCbteCble  = 0;
                    lstCobDetInfo         = GetDetalleCobro(Item, ref IdCobroDet);
                    CobrosInfo            = cobro_B.Get_Info_cobro_x_cliente(Item.IdEmpresa, Item.IdSucursal, IdCobroDet, Convert.ToInt32(Item.IdCliente));
                    CobrosInfo.ListaCobro = lstCobDetInfo;
                    cxc_cobro_Det_Bus BusDet_cobro = new cxc_cobro_Det_Bus();
                    resultCobro = BusDet_cobro.GuardarDB(CobrosInfo.ListaCobro);
                    //inserto la contabilidad de los registros
                    if (CbteCbleBus.GrabarDB(CbteCbleInfo, ref idCbteCble, ref mensaje))
                    {
                        //actualizo la cabecera de la concilacion con los id del cbte cble
                        Item.IdEmpresa_cbte_cble  = CbteCbleInfo.IdEmpresa;
                        Item.IdTipoCbte_cbte_cble = CbteCbleInfo.IdTipoCbte;
                        Item.IdCbteCble_cbte_cble = idCbteCble;
                        Item.IdConciliacion       = Id;
                        oData.ModificarConciliacion(Item, ref mensaje);
                    }
                }
                else
                {
                    CobrosInfo = Get_Cobro(Item, ref Id);
                    decimal IdCobro = 0;
                    resultCobro = cobro_B.GuardarDB(Cl_Enumeradores.PantallaEjecucion.COBROS, ref CobrosInfo, ref mensaje);
                }

                if (resultCobro)
                {
                    ModificarDB(Item, CobrosInfo, Id, ref mensaje);
                    info_NotaCreDeb = Get_faNotaCreDeb_x_Cobro(CobrosInfo, Item);
                    Bus_NotaCreDeb.GuardarDB(info_NotaCreDeb, ref mensaje);
                }


                return(true);
            }
            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_cobro_x_EstadoCobro", ex.Message), ex)
                      {
                          EntityType = typeof(cxc_cobro_x_EstadoCobro_Bus)
                      };
            }
        }