public Boolean guardarDB(cp_retencion_x_ct_cbtecble_Info info) { Boolean res = false; try { if (info.Observacion.Length > 50) { info.Observacion = info.Observacion.Substring(0, 50); } using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_retencion_x_ct_cbtecble Entity = new cp_retencion_x_ct_cbtecble { rt_IdRetencion = info.rt_IdRetencion, rt_IdEmpresa = info.ct_IdEmpresa, ct_IdEmpresa = info.ct_IdEmpresa, ct_IdTipoCbte = info.ct_IdTipoCbte, ct_IdCbteCble = info.ct_IdCbteCble, Observacion = info.Observacion }; Context.cp_retencion_x_ct_cbtecble.Add(Entity); Context.SaveChanges(); } return(res); } catch (Exception) { throw; } }
public cp_retencion_x_ct_cbtecble_Info get_info(int IdEmpresa, decimal IdRetencion) { try { cp_retencion_x_ct_cbtecble_Info info = new cp_retencion_x_ct_cbtecble_Info(); using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_retencion_x_ct_cbtecble Entity = Context.cp_retencion_x_ct_cbtecble.FirstOrDefault(q => q.rt_IdEmpresa == IdEmpresa & q.rt_IdRetencion == IdRetencion); if (Entity == null) { return(null); } info = new cp_retencion_x_ct_cbtecble_Info { rt_IdRetencion = Entity.rt_IdRetencion, rt_IdEmpresa = Entity.ct_IdEmpresa, ct_IdEmpresa = Entity.ct_IdEmpresa, ct_IdTipoCbte = Entity.ct_IdTipoCbte, ct_IdCbteCble = Entity.ct_IdCbteCble, Observacion = Entity.Observacion }; } return(info); } catch (Exception) { throw; } }
public Boolean AnularDB(cp_retencion_Info info, ref decimal idCbteCble_anu, ref string mensaje) { Boolean res = true; try { cp_parametros_Bus BusParam = new cp_parametros_Bus(); cp_parametros_Info InfoParam = new cp_parametros_Info(); InfoParam = BusParam.Get_Info_parametros(info.IdEmpresa); cp_retencion_x_ct_cbtecble_Info info_x_cbte = Get_Info_retencion_x_ct_cbtecble(info.IdEmpresa, info.IdRetencion); if (info_x_cbte.ct_IdEmpresa != 0) { info.Info_CbteCble_x_RT = CbteCble_B.Get_Info_CbteCble(info_x_cbte.ct_IdEmpresa, info_x_cbte.ct_IdTipoCbte, info_x_cbte.ct_IdCbteCble, ref mensaje); if (CbteCble_B.ReversoCbteCble(info.Info_CbteCble_x_RT.IdEmpresa, info.Info_CbteCble_x_RT.IdCbteCble, info.Info_CbteCble_x_RT.IdTipoCbte , Convert.ToInt32(InfoParam.pa_IdTipoCbte_x_Anu_Retencion), ref idCbteCble_anu, ref mensaje, info.IdUsuarioUltAnu, info.MotivoAnulacion)) { info.ct_IdEmpresa_Anu = info.Info_CbteCble_x_RT.IdEmpresa; info.ct_IdCbteCble_Anu = idCbteCble_anu; info.ct_IdTipoCbte_Anu = InfoParam.pa_IdTipoCbte_x_Anu_Retencion; } } return(data_retencion.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("", "AnularDB", ex.Message), ex) { EntityType = typeof(cp_retencion_Bus) }; } return(res); }
public bool guardarDB(cp_retencion_x_ct_cbtecble_Info info) { try { return(odata.guardarDB(info)); } catch (Exception) { throw; } }
public Boolean GrabarDB_Ret_CbteCble(cp_retencion_x_ct_cbtecble_Info TI, ref string mensaje) { try { return(data_retencion.GrabarDB_Ret_CbteCble(TI, 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("", "GrabarDB_Ret_CbteCble", ex.Message), ex) { EntityType = typeof(cp_retencion_Bus) }; } }
public Boolean Graba_CbteCble_Ret_FactProveedor(cp_retencion_Info info, ct_Cbtecble_Info cbtecble, ref string mensaje) { decimal idCbteCble = 0; Boolean res_Grabar_RT = false; Boolean res_Grabar_CbteCble_x_RT = false; try { if (cbtecble.IdTipoCbte == 0) { cp_parametros_Bus ParBu = new cp_parametros_Bus(); cp_parametros_Info ParaInfo = new cp_parametros_Info(); ParaInfo = ParBu.Get_Info_parametros(info.IdEmpresa); cbtecble.IdTipoCbte = Convert.ToInt32(ParaInfo.pa_IdTipoCbte_x_Retencion); } cbtecble.IdCbteCble = idCbteCble; if (string.IsNullOrEmpty(cbtecble.cb_Observacion)) { cbtecble.cb_Observacion = info.observacion; } foreach (var item in cbtecble._cbteCble_det_lista_info) { if (string.IsNullOrEmpty(item.dc_Observacion)) { item.dc_Observacion = "RT " + info.observacion; } } if (info.IdRetencion == 0) {//grabando cabecera y detalle de retencion res_Grabar_RT = GrabarDB(info); } else { res_Grabar_RT = true; // ya esta grabado } if (res_Grabar_RT) //si grabo la retencion se hace el diario { res_Grabar_CbteCble_x_RT = CbteCble_B.GrabarDB(cbtecble, ref idCbteCble, ref mensaje); //puede q no guarde el diario por q sea una retencion en 0% if (res_Grabar_CbteCble_x_RT && res_Grabar_RT)//si grabo cbte y retencion { cp_retencion_x_ct_cbtecble_Info TI = new cp_retencion_x_ct_cbtecble_Info(); TI.ct_IdCbteCble = idCbteCble; TI.ct_IdEmpresa = cbtecble.IdEmpresa; TI.ct_IdTipoCbte = cbtecble.IdTipoCbte; TI.Observacion = ""; TI.rt_IdEmpresa = info.IdEmpresa; TI.rt_IdRetencion = info.IdRetencion; GrabarDB_Ret_CbteCble(TI, ref mensaje); } } return(res_Grabar_RT); } 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("", "Graba_CbteCble_Ret_FactProveedor", ex.Message), ex) { EntityType = typeof(cp_retencion_Bus) }; } }