public bool Validar_periodo_cerrado_x_modulo(int IdEmpresa, Cl_Enumeradores.eModulos IdModulo, DateTime Fecha) { try { string MensajeError = ""; ct_Periodo_Info info_periodo = new ct_Periodo_Info(); ct_Periodo_Bus bus_periodo = new ct_Periodo_Bus(); info_periodo = bus_periodo.Get_Info_Periodo(IdEmpresa, Fecha, ref MensajeError); if (info_periodo == null) { MessageBox.Show("El periodo no se encuentra registrado en el sistema.", Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } ct_periodo_x_tb_modulo_Bus bus_periodo_x_modulo = new ct_periodo_x_tb_modulo_Bus(); if (bus_periodo_x_modulo.Esta_modulo_cerrado_x_periodo(IdEmpresa, IdModulo, info_periodo.IdPeriodo)) { MessageBox.Show("El periodo se encuentra cerrado para el Modulo:." + IdModulo.ToString(), Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } //Valido contabilidad ya que las pantallas estan atadas a contabilidad if (bus_periodo_x_modulo.Esta_modulo_cerrado_x_periodo(IdEmpresa, Cl_Enumeradores.eModulos.CONTA, info_periodo.IdPeriodo)) { MessageBox.Show("El periodo en el modulo Contabilidad en el que intenta realizar la transacción se encuentra cerrado.", Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } return(true); } catch (Exception) { throw; } }
private void frmpre_presupuesto_Load(object sender, EventArgs e) { try { ct_Periodo_Bus busperiodo = new ct_Periodo_Bus(); ultraCmb_Ano.Properties.DataSource = busperiodo.Get_List_Periodo(param.IdEmpresa, ref MensajeError); ultraCmb_Ano.Properties.DisplayMember = "IdanioFiscal"; ultraCmb_Ano.Properties.ValueMember = "IdanioFiscal"; ultraCmb_Ano.EditValue = DateTime.Now.Year; ultraCmb_Presupuesto.Properties.DataSource = bus.Get_List_pre_presupuest(param.IdEmpresa, Convert.ToString(ultraCmb_Ano.EditValue)); ultraCmb_Presupuesto.Properties.DisplayMember = "IdPresupuesto"; ultraCmb_Presupuesto.Properties.ValueMember = "IdPresupuesto"; ultraCmb_Presupuesto.EditValue = DateTime.Now.Year * 100 + 1; txtIdPresupuesto.Text = Convert.ToString(DateTime.Now.Year * 100 + 1); List <ct_Plancta_Info> listacta = new List <ct_Plancta_Info>(); listacta = busPlanCta.Get_List_Plancta(param.IdEmpresa, ref MensajeError); listacta.ForEach(x => x.pc_Cuenta = "[" + x.IdCtaCble + "] " + x.pc_Cuenta); LstCentroCosto = busCC.Get_list_Centro_Costo(param.IdEmpresa, ref MensajeError); if (LstCentroCosto.Count == 0) { MessageBox.Show("Se le informa que no podra Grabar debido a que no tiene ingresado Centro de Costo.. \nIngréselos desde el modulo de Contabilidad, o comuníquese con sistemas", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); } GridLookUpEditCtaCtble.DataSource = listacta; GridLookUpEditTipoRubro.DataSource = bustipo.Get_List_pre_presupuesto_tipoRubro(); GridLookUpEditCentroCosto.DataSource = LstCentroCosto; btnCargar_Click(new object(), new EventArgs()); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }
private void XACTF_Rpt011_frm_Load(object sender, EventArgs e) { try { //cargar combo string MensajeError = ""; ct_Periodo_Bus bus_Periodo = new ct_Periodo_Bus(); List <ct_Periodo_Info> lista = new List <ct_Periodo_Info>(); lista = bus_Periodo.Get_List_Periodo(param.IdEmpresa, ref MensajeError); cmb_Periodo.Properties.DataSource = lista; cmb_Periodo.Properties.DisplayMember = "nom_periodo"; cmb_Periodo.Properties.ValueMember = "IdPeriodo"; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cargar_combos() { try { ct_Periodo_Bus BusPeriodo = new ct_Periodo_Bus(); List <ct_Periodo_Info> ListPeriodo = new List <ct_Periodo_Info>(); int anio_actual = DateTime.Now.Year; ListPeriodo = BusPeriodo.Get_List_Periodo(param.IdEmpresa, ref MensajeError); foreach (var itemPeriodo in ListPeriodo) { if (anio_actual == itemPeriodo.IdanioFiscal) { chkList_Periodos.Items.Add(itemPeriodo, itemPeriodo.nom_periodo, CheckState.Checked, true); } else { chkList_Periodos.Items.Add(itemPeriodo, itemPeriodo.nom_periodo, CheckState.Unchecked, true); } } ct_Plancta_nivel_Bus BusNivel = new ct_Plancta_nivel_Bus(); List <ct_Plancta_nivel_Info> listNivel = new List <ct_Plancta_nivel_Info>(); listNivel = BusNivel.Get_list_Plancta_nivel(param.IdEmpresa); cmb_nivel.DataSource = listNivel; cmb_nivel.DisplayMember = "IdNivelCta"; cmb_nivel.ValueMember = "IdNivelCta"; cmb_nivel.SelectedValue = 5; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void uccxC_MenuReportes1_event_btnGenerar_File_txt_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { //string conv_num = ""; ct_Periodo_Bus busPeriodo = new ct_Periodo_Bus(); Lista_rpt = bus_rpt.Get_list(param.IdEmpresa, Convert.ToDateTime(uccxC_MenuReportes1.dtpDesde.EditValue), Convert.ToDateTime(uccxC_MenuReportes1.dtpHasta.EditValue)); gridControlDinardap.DataSource = Lista_rpt; List <Dinardap_Registros_cxc_Info> ListInfoDinardap = new List <Dinardap_Registros_cxc_Info>(); foreach (var item in Lista_rpt) { Dinardap_Registros_cxc_Info InfoDinardap = new Dinardap_Registros_cxc_Info(); InfoDinardap.FechaDatos = Convert.ToDateTime(uccxC_MenuReportes1.dtpHasta.EditValue).ToString("dd/MM/yyyy"); switch (item.IdTipoDocumento) { case "CED": InfoDinardap.TipoIden = "C"; break; case "PAS": InfoDinardap.TipoIden = "E"; break; case "RUC": InfoDinardap.TipoIden = "R"; break; default: InfoDinardap.TipoIden = "C"; break; } InfoDinardap.Identificacion = item.pe_cedulaRuc; InfoDinardap.Nom_apellido = item.pe_nombreCompleto; switch (item.pe_Naturaleza) { case "JURI": InfoDinardap.clase_suje = "J"; InfoDinardap.sexo = ""; InfoDinardap.estado_civil = ""; InfoDinardap.Origen_Ing = ""; break; case "NATU": InfoDinardap.clase_suje = "N"; InfoDinardap.sexo = (item.pe_sexo == "SEXO_MAS") ? "M" : "F"; InfoDinardap.Origen_Ing = "V"; switch (item.IdEstadoCivil) { case "CASAD": InfoDinardap.estado_civil = "C"; break; case "DIVOR": InfoDinardap.estado_civil = "D"; break; case "SOLTE": InfoDinardap.estado_civil = "S"; break; case "UNILI": InfoDinardap.estado_civil = "U"; break; case "VIUD": InfoDinardap.estado_civil = "V"; break; default: InfoDinardap.estado_civil = "S"; break; } break; case "OTRO": InfoDinardap.clase_suje = "N"; InfoDinardap.sexo = ""; InfoDinardap.estado_civil = ""; InfoDinardap.Origen_Ing = ""; break; case "RISE": InfoDinardap.clase_suje = "N"; InfoDinardap.sexo = ""; InfoDinardap.estado_civil = ""; InfoDinardap.Origen_Ing = ""; break; } InfoDinardap.Provincia = item.Cod_Provincia; InfoDinardap.canton = item.Cod_Ciudad; InfoDinardap.parroquia = item.cod_parroquia; InfoDinardap.num_operacion = item.num_factura; InfoDinardap.valor_ope = Math.Round(Math.Abs(Convert.ToDecimal(item.Valor_operacion)), 2, MidpointRounding.AwayFromZero); //conv_num = string.Format("{0:f2}", InfoDinardap.valor_ope); //InfoDinardap.valor_ope = string.Format("{0:f2}", InfoDinardap.valor_ope); //InfoDinardap.valor_ope = Convert.ToDecimal(conv_num); InfoDinardap.saldo_ope = 0; InfoDinardap.fecha_conse = item.vt_fecha.ToString("dd/MM/yyyy"); InfoDinardap.fecha_vct = item.vt_fecha.ToString("dd/MM/yyyy"); InfoDinardap.fecha_exigi = item.vt_fecha.ToString("dd/MM/yyyy"); InfoDinardap.Plazo_op = 30; InfoDinardap.Periodicidad_pago = 30; InfoDinardap.dias_morosidad = 0; InfoDinardap.monto_morosidad = 0; InfoDinardap.monto_inte_mora = 0; InfoDinardap.valor_x_vencer_1_30 = 0; InfoDinardap.valor_x_vencer_31_90 = 0; InfoDinardap.valor_x_vencer_91_180 = 0; InfoDinardap.valor_x_vencer_181_360 = 0; InfoDinardap.valor_x_vencer_mas_360 = 0; InfoDinardap.valor_vencido_1_30 = 0; InfoDinardap.valor_vencido_31_90 = 0; InfoDinardap.valor_vencido_91_180 = 0; InfoDinardap.valor_vencido_181_360 = 0; InfoDinardap.valor_vencido_mas_360 = 0; InfoDinardap.valor_en_demand_judi = 0; InfoDinardap.cartera_castigada = 0; InfoDinardap.couta_credito = 0; //Fecha de cobro InfoDinardap.fecha_cancela = item.vt_fecha.ToString("dd/MM/yyyy"); InfoDinardap.forma_cance = "E"; InfoDinardap.CodEntidad = param.InfoEmpresa.cod_entidad_dinardap; ListInfoDinardap.Add(InfoDinardap); } if (ListInfoDinardap.Count() > 0) { GuardarFile_txt(ListInfoDinardap); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }
private void btnAceptar_Click(object sender, EventArgs e) { try { var ITEMS = ListExcel.ToList().FindAll(v => v.chk == true); if (!Validar()) { return; } ct_Periodo_Bus BusPeriodo = new ct_Periodo_Bus(); ba_Cbte_Ban_Bus BUSBANCOSCOMPROBANTE = new ba_Cbte_Ban_Bus(); List <ba_Cbte_Ban_tipo_x_ct_CbteCble_tipo_Info> _Parametros_ = _BusCbtBanXCtbtCble.Get_List_Cbte_Ban_tipo_x_ct_CbteCble_tipo(param.IdEmpresa); foreach (var item in ITEMS) { var prm = _Parametros_.First(v => v.CodTipoCbteBan == item.CodTipoCbteBan.Trim()); ct_Cbtecble_Info CabeceraCbte = new ct_Cbtecble_Info(); CabeceraCbte.IdEmpresa = param.IdEmpresa; CabeceraCbte.IdTipoCbte = prm.IdTipoCbteCble; CabeceraCbte.IdPeriodo = BusPeriodo.Get_Info_Periodo(param.IdEmpresa, item.cb_Fecha, ref MensajeError).IdPeriodo; CabeceraCbte.IdUsuario = param.IdUsuario; CabeceraCbte.IdUsuarioUltModi = param.IdUsuario; CabeceraCbte.Mayorizado = "N"; CabeceraCbte.cb_Fecha = item.cb_Fecha; CabeceraCbte.cb_Observacion = item.cb_Observacion; CabeceraCbte.cb_Valor = item.dc_Valor; CabeceraCbte.Estado = "A"; CabeceraCbte.cb_FechaTransac = param.Fecha_Transac; CabeceraCbte.cb_FechaUltModi = CabeceraCbte.cb_FechaTransac; ct_Cbtecble_det_Info DetalleInfo = new ct_Cbtecble_det_Info(); DetalleInfo.IdEmpresa = param.IdEmpresa; DetalleInfo.IdTipoCbte = CabeceraCbte.IdEmpresa; DetalleInfo.secuencia = 1; DetalleInfo.IdCtaCble = IdCtaCbleBanco; DetalleInfo.IdCentroCosto = item.IdCentroCosto; if (item.CodTipoCbteBan == "NCBA") { DetalleInfo.dc_Valor = item.dc_Valor * -1; } if (item.CodTipoCbteBan == "NDBA") { DetalleInfo.dc_Valor = item.dc_Valor; } DetalleInfo.dc_Observacion = item.cb_Observacion; CabeceraCbte._cbteCble_det_lista_info.Add(DetalleInfo); DetalleInfo = new ct_Cbtecble_det_Info(); DetalleInfo.IdEmpresa = param.IdEmpresa; DetalleInfo.IdTipoCbte = CabeceraCbte.IdEmpresa; DetalleInfo.secuencia = 2; DetalleInfo.IdCtaCble = item.IdCtaCble; DetalleInfo.IdCentroCosto = item.IdCentroCosto; if (item.CodTipoCbteBan == "NCBA") { DetalleInfo.dc_Valor = item.dc_Valor; } if (item.CodTipoCbteBan == "NDBA") { DetalleInfo.dc_Valor = item.dc_Valor * -1; } DetalleInfo.dc_Observacion = item.cb_Observacion; CabeceraCbte._cbteCble_det_lista_info.Add(DetalleInfo); decimal IdCbte = 0; string Mensaje = ""; string Codigo = ""; BUS_CONTABILIDAD.GrabarDB(CabeceraCbte, ref IdCbte, ref Mensaje); item.IdHASH = string.Format("{0}-MOVI_BAN$-s{1}-{2}-{3}-d{4}-{5}-{6}", fileName, item.SecuenciaRelacionado, item.cb_Fecha, item.CodTipoCbteBan, item.cb_Cheque, item.cb_Observacion, item.dc_Valor); ba_Cbte_Ban_Info COMPROBANTEBANCARIO = new ba_Cbte_Ban_Info(); COMPROBANTEBANCARIO.IdEmpresa = param.IdEmpresa; COMPROBANTEBANCARIO.IdCbteCble = IdCbte; COMPROBANTEBANCARIO.IdTipocbte = CabeceraCbte.IdTipoCbte; COMPROBANTEBANCARIO.Cod_Cbtecble = Codigo; COMPROBANTEBANCARIO.IdPeriodo = CabeceraCbte.IdPeriodo; COMPROBANTEBANCARIO.IdBanco = IdBanco; COMPROBANTEBANCARIO.cb_Fecha = item.cb_Fecha; COMPROBANTEBANCARIO.cb_Observacion = item.cb_Observacion; COMPROBANTEBANCARIO.cb_Valor = item.dc_Valor; COMPROBANTEBANCARIO.cb_ChequeImpreso = "N"; COMPROBANTEBANCARIO.IdUsuario = param.IdUsuario; COMPROBANTEBANCARIO.IdUsuarioUltMod = param.IdUsuario; COMPROBANTEBANCARIO.ip = param.ip; COMPROBANTEBANCARIO.nom_pc = param.nom_pc; COMPROBANTEBANCARIO.Fecha_Transac = param.Fecha_Transac; COMPROBANTEBANCARIO.Fecha_UltMod = COMPROBANTEBANCARIO.Fecha_Transac; //COMPROBANTEBANCARIO.IdTipoNota = null; COMPROBANTEBANCARIO.IdTransaccion = item.IdHASH; BUSBANCOSCOMPROBANTE.GrabarDB(COMPROBANTEBANCARIO, ref MensajeError); item.IdCbteCble = IdCbte; item.IdTipocbte = CabeceraCbte.IdTipoCbte; } GetList_NotadasDeb_Cred(ITEMS); Close(); } 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()); } }
private void XCONTA_Rpt017_rpt_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { xrLfecha.Text = DateTime.Now.ToString(); xrLusuario.Text = param.IdUsuario; lblEmpresa.Text = param.NombreEmpresa; try { string msg = ""; XCONTA_Rpt017_Bus Bus = new XCONTA_Rpt017_Bus(); List <XCONTA_Rpt017_Info> lista = new List <XCONTA_Rpt017_Info>(); int IdEmpresa = 0; int IdNivel_a_mostrar = 0; string IdGrupoCble = ""; bool Mostrar_Reg_en_cero = false; bool Mostrar_CC = false; int IdPeriodo_Corte = 0; IdEmpresa = Convert.ToInt32(PIdEmpresa.Value); IdNivel_a_mostrar = Convert.ToInt32(PIdNivel_a_mostrar.Value); Mostrar_Reg_en_cero = Convert.ToBoolean(PMostrar_Reg_en_cero.Value); Mostrar_CC = Convert.ToBoolean(P_MostrarCC.Value); IdGrupoCble = P_GrupoCble.Value.ToString(); if (lista_periodo_a_buscar.Count == 0) { ct_Periodo_Bus BusPeriodo = new ct_Periodo_Bus(); List <ct_Periodo_Info> listPeriodo_aux = new List <ct_Periodo_Info>(); List <ct_Periodo_Info> listPeriodo = new List <ct_Periodo_Info>(); listPeriodo_aux = BusPeriodo.Get_List_Periodo(param.IdEmpresa, ref msg); IdPeriodo_Corte = (DateTime.Now.Year * 100) + DateTime.Now.Month; int fila = 1; foreach (var item in listPeriodo_aux.OrderByDescending(q => q.IdPeriodo).ToList()) { if (fila <= 12) { lista_periodo_a_buscar.Add(item); } fila++; } } lista = Bus.consultar_data(IdEmpresa, lista_periodo_a_buscar, "", IdNivel_a_mostrar, 0, 0, Mostrar_Reg_en_cero, Mostrar_CC, IdGrupoCble, param.IdUsuario, ref msg); foreach (var item in lista) { if (item.nom_Periodo_1 == "") { cel_det_01.Visible = false; cel_gru_1.Visible = false; } if (item.nom_Periodo_2 == "") { cel_det_02.Visible = false; cel_gru_2.Visible = false; } if (item.nom_Periodo_3 == "") { cel_det_03.Visible = false; cel_gru_3.Visible = false; } if (item.nom_Periodo_4 == "") { cel_det_04.Visible = false; cel_gru_4.Visible = false; } if (item.nom_Periodo_5 == "") { cel_det_05.Visible = false; cel_gru_5.Visible = false; } if (item.nom_Periodo_6 == "") { cel_det_06.Visible = false; cel_gru_6.Visible = false; } if (item.nom_Periodo_7 == "") { cel_det_07.Visible = false; cel_gru_7.Visible = false; } if (item.nom_Periodo_8 == "") { cel_det_08.Visible = false; cel_gru_8.Visible = false; } if (item.nom_Periodo_9 == "") { cel_det_09.Visible = false; cel_gru_9.Visible = false; } if (item.nom_Periodo_10 == "") { cel_det_10.Visible = false; cel_gru_10.Visible = false; } if (item.nom_Periodo_11 == "") { cel_det_11.Visible = false; cel_gru_11.Visible = false; } if (item.nom_Periodo_12 == "") { cel_det_12.Visible = false; cel_gru_12.Visible = false; } break; } if (lista.Count == 0) { xrLmensaje.Visible = true; xrLmensaje.Text = "No hay datos encontrados para estos filtros"; } else { xrLmensaje.Visible = false; } this.DataSource = lista.ToArray(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); 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("", "XCONTA_Rpt001_rpt_BeforePrint", ex.Message), ex) { EntityType = typeof(XCONTA_Rpt001_rpt) }; } }
public ct_Cbtecble_Info GetCbtecble_x_Depreacion(int IdEmpresa, int IdTipoCbteDepre, int IdPeriodo, List <vwAf_Valores_Depre_Contabilizar_Info> ListInfo_data, Cl_Enumeradores.eForma_Contabilizar sFormaContabiliza, ref string sMensajeError) { try { ct_Cbtecble_Info CbteCbleInfo = new ct_Cbtecble_Info(); ct_Periodo_Info InfoPeriodo = new ct_Periodo_Info(); ct_Periodo_Bus BusPeriodo = new ct_Periodo_Bus(); DateTime Fecha_Contab = new DateTime(); InfoPeriodo = BusPeriodo.Get_Info_Periodo(IdEmpresa, IdPeriodo, ref sMensajeError); Fecha_Contab = InfoPeriodo.pe_FechaFin; CbteCbleInfo.IdEmpresa = IdEmpresa; CbteCbleInfo.IdTipoCbte = IdTipoCbteDepre; CbteCbleInfo.CodCbteCble = ""; CbteCbleInfo.IdCbteCble = 0; CbteCbleInfo.IdPeriodo = (Fecha_Contab.Year * 100) + Fecha_Contab.Month; CbteCbleInfo.cb_Fecha = Fecha_Contab; CbteCbleInfo.cb_Valor = ListInfo_data.Where(q => q.Valor_Depreciacion > 0).Sum(q => q.Valor_Depreciacion); CbteCbleInfo.cb_Observacion = "Contabilizacion " + Cl_Enumeradores.eTipoDepreciacion.DEP_LIN.ToString() + " Por " + sFormaContabiliza.ToString() + " Periodo " + IdPeriodo; CbteCbleInfo.Secuencia = 0; CbteCbleInfo.Estado = "A"; CbteCbleInfo.Anio = Convert.ToDateTime(CbteCbleInfo.cb_Fecha).Year; CbteCbleInfo.Mes = Convert.ToDateTime(CbteCbleInfo.cb_Fecha).Month; //CbteCbleInfo.IdUsuario = param.IdUsuario; CbteCbleInfo.cb_FechaTransac = DateTime.Now; CbteCbleInfo.Mayorizado = "N"; List <ct_Cbtecble_det_Info> lstDetalle = new List <ct_Cbtecble_det_Info>(); List <Af_Activo_fijo_CtasCbles_Info> ListInfo_Activos_x_ctas = new List <Af_Activo_fijo_CtasCbles_Info>(); Af_Activo_fijo_CtasCbles_Bus BusAf_x_ctaCbles = new Af_Activo_fijo_CtasCbles_Bus(); ListInfo_Activos_x_ctas = BusAf_x_ctaCbles.Get_List_Activo_fijo_CtasCbles(IdEmpresa); Af_Parametros_Info info_param_af = new Af_Parametros_Info(); Af_Parametros_Bus bus_param_af = new Af_Parametros_Bus(); info_param_af = bus_param_af.Get_Info_Parametros(IdEmpresa); #region Contabilización x activo foreach (var item_x_data in ListInfo_data) { List <Af_Activo_fijo_CtasCbles_Info> ListInfo_Af_x_ctas = new List <Af_Activo_fijo_CtasCbles_Info>(); if (info_param_af.FormaContabiliza == Cl_Enumeradores.eForma_Contabilizar.Por_Activo.ToString()) { ListInfo_Af_x_ctas = ListInfo_Activos_x_ctas.Where(v => v.IdEmpresa == IdEmpresa && v.IdActivoFijo == item_x_data.IdActivoFijo).ToList(); } if (info_param_af.FormaContabiliza == Cl_Enumeradores.eForma_Contabilizar.Por_CtaCble.ToString()) { } if (info_param_af.FormaContabiliza == Cl_Enumeradores.eForma_Contabilizar.Por_Tipo_CtaCble.ToString()) { ListInfo_Af_x_ctas = ListInfo_Activos_x_ctas.Where(v => v.IdEmpresa == IdEmpresa && v.IdActijoFijoTipo == item_x_data.IdActijoFijoTipo).ToList(); } vwAf_Valores_Depre_Contabilizar_Info Info_valores_depre_con_x_Gasto_depre = new vwAf_Valores_Depre_Contabilizar_Info(); Info_valores_depre_con_x_Gasto_depre = item_x_data; ////////////////////////////// var q_Gastos_x_depre = from C in ListInfo_Af_x_ctas where C.IdTipoCuenta == "CTA_GASTOS_DEPRE" group C by new { C.IdEmpresa, C.IdTipoCuenta, C.IdCtaCble, C.porc_distribucion } into grouping select new { grouping.Key, Total_reg = grouping.Count() }; if (q_Gastos_x_depre.Count() == 1) // solo hay una cuenta x CTA_GASTOS_DEPRE { foreach (var item_x_cta in q_Gastos_x_depre) { Info_valores_depre_con_x_Gasto_depre.IdCtaCbleGastos = item_x_cta.Key.IdCtaCble; Info_valores_depre_con_x_Gasto_depre.Valor_a_contabilizar = item_x_data.Valor_Depreciacion; } } else// mas de una cta distribuir por % { foreach (var item_x_cta in q_Gastos_x_depre) { Info_valores_depre_con_x_Gasto_depre.IdCtaCbleGastos = item_x_cta.Key.IdCtaCble; Info_valores_depre_con_x_Gasto_depre.Valor_a_contabilizar = (item_x_data.Valor_Depreciacion * item_x_cta.Key.porc_distribucion) / 100; } } /// ////////////////////////////// ///////// Info_valores_depre_con_x_depre_Acum vwAf_Valores_Depre_Contabilizar_Info Info_valores_depre_con_x_depre_Acum = new vwAf_Valores_Depre_Contabilizar_Info(); Info_valores_depre_con_x_depre_Acum = item_x_data; var q_depre_Acumulada = from C in ListInfo_Af_x_ctas where C.IdTipoCuenta == "CTA_DEPRE_ACUM" group C by new { C.IdEmpresa, C.IdTipoCuenta, C.IdCtaCble, C.porc_distribucion } into grouping select new { grouping.Key, Total_reg = grouping.Count() }; if (q_depre_Acumulada.Count() == 1) // solo hay una cuenta x CTA_DEPRE_ACUM { foreach (var item_x_cta in q_depre_Acumulada) { Info_valores_depre_con_x_depre_Acum.IdCtaCbleDepre = item_x_cta.Key.IdCtaCble; Info_valores_depre_con_x_depre_Acum.Valor_a_contabilizar = item_x_data.Valor_Depreciacion; } } else// mas de una cta distribuir por % { foreach (var item_x_cta in q_depre_Acumulada) { Info_valores_depre_con_x_depre_Acum.IdCtaCbleDepre = item_x_cta.Key.IdCtaCble; Info_valores_depre_con_x_depre_Acum.Valor_a_contabilizar = (item_x_data.Valor_Depreciacion * item_x_cta.Key.porc_distribucion) / 100; } } ct_Cbtecble_det_Info infoDetalle = new ct_Cbtecble_det_Info(); infoDetalle = new ct_Cbtecble_det_Info(); infoDetalle.IdEmpresa = IdEmpresa; infoDetalle.IdTipoCbte = IdTipoCbteDepre; infoDetalle.IdCtaCble = Info_valores_depre_con_x_Gasto_depre.IdCtaCbleGastos; infoDetalle.dc_Valor = Info_valores_depre_con_x_Gasto_depre.Valor_a_contabilizar; infoDetalle.dc_Observacion = CbteCbleInfo.cb_Observacion; infoDetalle.secuencia = 1; lstDetalle.Add(infoDetalle); //datos el haber infoDetalle = new ct_Cbtecble_det_Info(); infoDetalle.IdEmpresa = IdEmpresa; infoDetalle.IdTipoCbte = IdTipoCbteDepre; infoDetalle.IdCtaCble = Info_valores_depre_con_x_depre_Acum.IdCtaCbleDepre; infoDetalle.dc_Valor = Info_valores_depre_con_x_depre_Acum.Valor_a_contabilizar * -1; infoDetalle.dc_Observacion = CbteCbleInfo.cb_Observacion; infoDetalle.secuencia = 2; lstDetalle.Add(infoDetalle); } CbteCbleInfo._cbteCble_det_lista_info = lstDetalle; #endregion return(CbteCbleInfo); } 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("", "ContabilizarDepreciacion", ex.Message), ex) { EntityType = typeof(Af_Depreciacion_Bus) }; } }
public Boolean AnularDevolucion(int idEmpresa, int idSucursal, int idBodega, decimal idDevolucion, DateTime Fecha_Anulacion, string motivo, ref string mensageError) { try { in_movi_inve_Bus MoviInve_Bus = new in_movi_inve_Bus(); in_movi_inve_Info InfoMoviAnu = new in_movi_inve_Info(); fa_devol_venta_Bus DevVtaBus = new fa_devol_venta_Bus(); fa_devol_venta_Info DevVta_info = new fa_devol_venta_Info(); fa_notaCredDeb_Bus BusBNotaDB = new fa_notaCredDeb_Bus(); fa_notaCreDeb_Info InfoNotaCre = new fa_notaCreDeb_Info(); Boolean resAnuMoviInv; Boolean resAnuDevVta; string MensajeError = ""; Fecha_Anulacion = Convert.ToDateTime(Fecha_Anulacion.ToShortDateString()); #region "validaciones" ct_Periodo_Bus Perbus = new ct_Periodo_Bus(); if (Perbus.Get_Periodo_Esta_Cerrado(idEmpresa, Fecha_Anulacion, ref MensajeError)) { mensageError = "no se puede anular por q el periodo esta cerrardo para esta fecha de anulacion"; return(false); } #endregion DevVta_info = DevVtaBus.Get_Info_devol_vent(idEmpresa, idSucursal, idBodega, idDevolucion, ref mensageError); ///////// optengo el movimiento de inventario q se genero por la devolcuion en vta InfoMoviAnu = MoviInve_Bus.Get_Info_Movi_inven (DevVta_info.mvInv_IdEmpresa, DevVta_info.mvInv_IdSucursal, DevVta_info.mvInv_IdBodega, DevVta_info.mvInv_IdMovi_inven_tipo, DevVta_info.mvInv_IdNumMovi); /////////////// InfoMoviAnu.MotivoAnulacion = motivo; InfoMoviAnu.IdusuarioUltAnu = param.IdUsuario; //////////// anula el movimiento de inventario ///////////////////////// resAnuMoviInv = MoviInve_Bus.AnularDB(InfoMoviAnu, Fecha_Anulacion, ref mensageError); //////////// anula el movimiento de inventario ///////////////////////// //////////// anula el la cabecera de dev vat resAnuDevVta = data.AnularDB(idEmpresa, idSucursal, idBodega, idDevolucion, motivo); //////////// anula el la cabecera de dev vat //////////// anula la nota de credito InfoNotaCre = BusBNotaDB.Get_Info_notaCreDeb_x_ND(idEmpresa, idSucursal, idBodega, DevVta_info.IdNota); InfoNotaCre.MotiAnula = motivo; InfoNotaCre.IdUsuarioUltAnu = param.IdUsuario; InfoNotaCre.Fecha_UltAnu = Fecha_Anulacion; BusBNotaDB.AnularDB(InfoNotaCre, ref mensageError); //////////// anula la nota de credito ///modifica la devolucion /// return(resAnuMoviInv && resAnuDevVta); } 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("", "AnularDevolucion", ex.Message), ex) { EntityType = typeof(fa_devol_venta_Bus) }; } }
void ConsultarDatos_para_inardap() { try { XCXC_Rpt015_Bus rptBus = new XCXC_Rpt015_Bus(); List <XCXC_Rpt015_Info> lstRpt = new List <XCXC_Rpt015_Info>(); ct_Periodo_Info InfoPeriodo = new ct_Periodo_Info(); int IdSucursalIni = 0; int IdSucursalFin = 0; int IdPeriodo = 0; string msg = ""; IdSucursalIni = (uccxC_MenuReportes.beiSucursal.EditValue == null) ? 0 : Convert.ToInt32(uccxC_MenuReportes.beiSucursal.EditValue); IdSucursalFin = (uccxC_MenuReportes.beiSucursal.EditValue == null || Convert.ToInt32(uccxC_MenuReportes.beiSucursal.EditValue) == 0) ? 999999 : Convert.ToInt32(uccxC_MenuReportes.beiSucursal.EditValue); IdPeriodo = (Int32)uccxC_MenuReportes.bei_Periodo.EditValue; if (IdPeriodo == 0) { MessageBox.Show("el reporte para Dinardap se ejecuta por periodo seleccion un periodo"); return; } ct_Periodo_Bus busPeriodo = new ct_Periodo_Bus(); InfoPeriodo = busPeriodo.Get_Info_Periodo(param.IdEmpresa, IdPeriodo, ref msg); lstRpt = rptBus.get_DetalleCarteraVencida(param.IdEmpresa, 0, IdSucursalIni, IdSucursalFin, InfoPeriodo.pe_FechaIni, InfoPeriodo.pe_FechaFin, 0); List <Dinardap_Registros_cxc_Info> ListInfoDinardap = new List <Dinardap_Registros_cxc_Info>(); foreach (var item in lstRpt) { Dinardap_Registros_cxc_Info InfoDinardap = new Dinardap_Registros_cxc_Info(); InfoDinardap.FechaDatos = InfoPeriodo.pe_FechaFin.ToString("dd/MM/yyyy"); switch (item.IdTipoDocumento) { case "CED": InfoDinardap.TipoIden = "C"; break; case "PAS": InfoDinardap.TipoIden = "E"; break; case "RUC": InfoDinardap.TipoIden = "R"; break; default: InfoDinardap.TipoIden = "C"; break; } InfoDinardap.Identificacion = item.pe_cedulaRuc.Trim(); InfoDinardap.Nom_apellido = item.pe_nombreCompleto.Trim(); switch (item.Naturaleza) { case "JURI": InfoDinardap.clase_suje = "J"; InfoDinardap.sexo = ""; InfoDinardap.estado_civil = ""; InfoDinardap.Origen_Ing = ""; break; case "NATU": InfoDinardap.clase_suje = "N"; InfoDinardap.sexo = (item.sexo == "SEXO_MAS") ? "M" : "F"; InfoDinardap.Origen_Ing = "V"; switch (item.IdEstadoCivil) { case "CASAD": InfoDinardap.estado_civil = "C"; break; case "DIVOR": InfoDinardap.estado_civil = "D"; break; case "SOLTE": InfoDinardap.estado_civil = "S"; break; case "UNILI": InfoDinardap.estado_civil = "U"; break; case "VIUD": InfoDinardap.estado_civil = "V"; break; default: InfoDinardap.estado_civil = "S"; break; } break; case "OTRO": InfoDinardap.clase_suje = "N"; InfoDinardap.sexo = ""; InfoDinardap.estado_civil = ""; InfoDinardap.Origen_Ing = ""; break; case "RISE": InfoDinardap.clase_suje = "N"; InfoDinardap.sexo = ""; InfoDinardap.estado_civil = ""; InfoDinardap.Origen_Ing = ""; break; } InfoDinardap.Provincia = item.Cod_Provincia; InfoDinardap.canton = item.Cod_Ciudad; InfoDinardap.parroquia = item.Cod_Parroquia; InfoDinardap.num_operacion = item.vt_NumFactura != null ? /*item.vt_serie1 + "-" + item.vt_serie2 + "-" +*/ item.vt_NumFactura : item.CodCbteVta; InfoDinardap.valor_ope = Math.Round(Math.Abs(Convert.ToDecimal(item.Valor_Original)), 2, MidpointRounding.AwayFromZero); InfoDinardap.saldo_ope = Math.Round(Math.Abs(Convert.ToDecimal(item.Valor_Original)), 2, MidpointRounding.AwayFromZero) - Math.Round(Math.Abs(Convert.ToDecimal(item.Total_Pagado)), 2, MidpointRounding.AwayFromZero); InfoDinardap.fecha_conse = item.vt_fecha.ToString("dd/MM/yyyy"); InfoDinardap.fecha_vct = Convert.ToDateTime(item.vt_fech_venc).ToString("dd/MM/yyyy"); InfoDinardap.fecha_exigi = Convert.ToDateTime(item.vt_fech_venc).ToString("dd/MM/yyyy"); // InfoDinardap.Plazo_op = item.Plazo; InfoDinardap.Periodicidad_pago = item.Plazo; if (InfoDinardap.Plazo_op <= 0) { InfoDinardap.Plazo_op = 1; } if (InfoDinardap.Plazo_op > 99999) { InfoDinardap.Plazo_op = 99999; } if (InfoDinardap.Periodicidad_pago <= 0) { InfoDinardap.Periodicidad_pago = 1; } if (InfoDinardap.Periodicidad_pago > 99999) { InfoDinardap.Periodicidad_pago = 99999; } InfoDinardap.dias_morosidad = Math.Abs(Convert.ToDecimal(item.Dias_Vencidos)); InfoDinardap.monto_morosidad = InfoDinardap.dias_morosidad == 0 ? 0 : Math.Round(Math.Abs(Convert.ToDecimal(item.Valor_Vencido)), 2, MidpointRounding.AwayFromZero); InfoDinardap.monto_inte_mora = 0; if (item.x_Vencer_1_30_Dias != 0 || item.x_Vencer_31_90_Dias != 0 || item.x_Vencer_91_180_Dias != 0 || item.x_Vencer_181_360_Dias != 0 || item.x_Vencer_Mayor_a_360Dias != 0 || item.Vencido_1_30_Dias != 0 || item.Vencido_31_90_Dias != 0 || item.Vencido_91_180_Dias != 0 || item.Vencido_181_360_Dias != 0 || item.Vencido_Mayor_a_360Dias != 0) { //VALORES POR VENCER SE DEBEN CONSIDERAR EN MORA? } InfoDinardap.valor_x_vencer_1_30 = Math.Round(Math.Abs(Convert.ToDecimal(item.x_Vencer_1_30_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_x_vencer_31_90 = Math.Round(Math.Abs(Convert.ToDecimal(item.x_Vencer_31_90_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_x_vencer_91_180 = Math.Round(Math.Abs(Convert.ToDecimal(item.x_Vencer_91_180_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_x_vencer_181_360 = Math.Round(Math.Abs(Convert.ToDecimal(item.x_Vencer_181_360_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_x_vencer_mas_360 = Math.Round(Math.Abs(Convert.ToDecimal(item.x_Vencer_Mayor_a_360Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_vencido_1_30 = Math.Round(Math.Abs(Convert.ToDecimal(item.Vencido_1_30_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_vencido_31_90 = Math.Round(Math.Abs(Convert.ToDecimal(item.Vencido_31_90_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_vencido_91_180 = Math.Round(Math.Abs(Convert.ToDecimal(item.Vencido_91_180_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_vencido_181_360 = Math.Round(Math.Abs(Convert.ToDecimal(item.Vencido_181_360_Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_vencido_mas_360 = Math.Round(Math.Abs(Convert.ToDecimal(item.Vencido_Mayor_a_360Dias)), 2, MidpointRounding.AwayFromZero); InfoDinardap.valor_en_demand_judi = 0; InfoDinardap.cartera_castigada = 0; InfoDinardap.couta_credito = Math.Round(Math.Abs(Convert.ToDecimal(item.Valor_Vencido == 0 ? item.Valor_x_Vencer : item.Valor_Vencido)), 2, MidpointRounding.AwayFromZero); //Fecha de cobro InfoDinardap.fecha_cancela = ""; //item.cr_fechaCobro == null || item.Total_Pagado == 0 ? "" : Convert.ToDateTime(item.cr_fechaCobro).ToString("dd/MM/yyyy"); InfoDinardap.forma_cance = ""; //item.cr_fechaCobro == null ? "" : "E"; InfoDinardap.CodEntidad = item.cod_entidad_dinardap; ListInfoDinardap.Add(InfoDinardap); } if (ListInfoDinardap.Count() > 0) { GuardarFile_txt(ListInfoDinardap, InfoPeriodo); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean validar() { try { ct_Periodo_Bus Per_B = new ct_Periodo_Bus(); Per_I = Per_B.Get_Info_Periodo(param.IdEmpresa, dtpFecha.Value, ref MensajeError); if (Per_I.pe_estado == "I") { MessageBox.Show("No se procedio a Grabar porque el Periodo se encuentra cerrado ", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (_Info.IdOrdenCompraExt == null || _Info.IdOrdenCompraExt == 0) { MessageBox.Show("Por Favor seleccione Importacion"); return(false); } if (_Info.CodDocu_Pago == "" || _Info.CodDocu_Pago == null) { MessageBox.Show("Por Favor seleccione Documento de Pago"); return(false); } if (_Info.CodDocu_Pago == "DEBBAN") { if (_Info.IdProveedor == null || _Info.IdProveedor == 0) { MessageBox.Show("Por Favor seleccione Proveedor"); return(false); } } if (_Info.ListaGastos.Count == 0 || _Info.ListaGastos == null) { MessageBox.Show("Por favor Ingrese Tipo de gasto"); return(false); } foreach (var item in _Info.ListaGastos) { int c = 0; foreach (var item1 in _Info.ListaGastos) { if (item.IdGastoImp == item1.IdGastoImp) { c++; if (c > 1) { MessageBox.Show("No puede seleccionar dos tipos de gastos iguales"); return(false); } } } if (item.Valor == 0) { MessageBox.Show("Debe Ingresar Valores En los tipos de gastos"); return(false); } } for (int i = 0; i < gridViewGastos.RowCount; i++) { imp_ordencompra_ext_x_imp_gastosxImport_Det_Info asd = (imp_ordencompra_ext_x_imp_gastosxImport_Det_Info)gridViewGastos.GetRow(i); if (asd != null) { if (asd.IdGastoImp == null || asd.IdGastoImp == 0) { MessageBox.Show("Verifique datos De la Tabla Sean correcto"); return(false); } } } return(true); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); return(false); } }
public Boolean Liquidar(imp_ordencompra_ext_Info Obj, ref string mensaje, Cl_Enumeradores.eTipo_action accion) { try { decimal IdCbteLiquidacion = 0; ct_Cbtecble_det_Info _detCbteCble_Info = new ct_Cbtecble_det_Info(); List <ct_Cbtecble_det_Info> LstCbteCble = new List <ct_Cbtecble_det_Info>(); ct_Cbtecble_Info CbteCble_I = new ct_Cbtecble_Info(); imp_ordencompra_ext_det_Bus ImporDet_bus = new imp_ordencompra_ext_det_Bus(); List <imp_ordencompra_ext_det_Info> ListInfo_det_Impor = new List <imp_ordencompra_ext_det_Info>(); in_categorias_data dataCategoria = new in_categorias_data(); ct_Periodo_Bus Per_B = new ct_Periodo_Bus(); ct_Periodo_Info Per_I = new ct_Periodo_Info(); in_Parametro_Data dataInParametro = new in_Parametro_Data(); imp_ordencompra_ext_Bus BusImportacion = new imp_ordencompra_ext_Bus(); ct_Cbtecble_Bus Buscbte = new ct_Cbtecble_Bus(); imp_ordencompra_ext_x_ct_cbtecble_Bus BusOrdxCbt = new imp_ordencompra_ext_x_ct_cbtecble_Bus(); ct_cbtecble_Reversado_Bus BusReverso = new ct_cbtecble_Reversado_Bus(); imp_Parametros_Info tip = new imp_Parametros_Info(); imp_Parametros_Bus Data_parametros = new imp_Parametros_Bus(); cl_parametrosGenerales_Bus param = cl_parametrosGenerales_Bus.Instance; imp_ordencompra_ext_x_ct_cbtecble_Info ordCompraxCbte_info = new imp_ordencompra_ext_x_ct_cbtecble_Info(); tip = Data_parametros.Get_Info_Parametros(param.IdEmpresa); ordCompraxCbte_info.ct_IdEmpresa = ordCompraxCbte_info.imp_IdEmpresa = param.IdEmpresa; ordCompraxCbte_info.imp_IdOrdenCompraExt = Obj.IdOrdenCompraExt; ordCompraxCbte_info.imp_IdSucusal = Obj.IdSucusal; // var DiarioLiqui = BusImportacion.consultaDiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI") // var CobteLiquidacion = Buscbte.ObtenerObjeto(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte); switch (accion) { case Cl_Enumeradores.eTipo_action.grabar: if (Obj.ci_tonelaje == null || Obj.ci_tonelaje == 0) { mensaje = "Error al generar Diario de Importación ya que no se puede dividir el total de liquidación para un valor de tonelaje = 0 "; } else { string cod_CbteCble = ""; decimal idCbteCble = 0; string MensajeError = ""; cp_proveedor_Data _Prove_D = new cp_proveedor_Data(); var proveedor = _Prove_D.Get_Info_Proveedor(param.IdEmpresa, Obj.IdProveedor); Per_I = Per_B.Get_Info_Periodo(Obj.IdEmpresa, Obj.ci_fecha_liquidacion, ref MensajeError); string Observacion = "Cont. x Imp. #" + Obj.CodOrdenCompraExt + "'\'" + Obj.IdOrdenCompraExt + " Liquidacion de Importacion :" + proveedor.pr_nombre + "//" + Obj.ci_Observacion; ListInfo_det_Impor = ImporDet_bus.Get_List_ordencompra_ext_det(Obj); int contItems = ListInfo_det_Impor.Count(); foreach (var item in ListInfo_det_Impor) { _detCbteCble_Info = new ct_Cbtecble_det_Info(); var Categoria = dataCategoria.Get_Info_categorias(param.IdEmpresa, item.IdCategoria); if (Categoria.IdCtaCtble_Inve == null) { in_Parametro_Info Info_InParametro = new in_Parametro_Info(); Info_InParametro = dataInParametro.Get_Info_Parametro(param.IdEmpresa); _detCbteCble_Info.IdCtaCble = Info_InParametro.IdCtaCble_Inven; _detCbteCble_Info.dc_Observacion = "Cta. Ctble tomada de los parámetros de inventario / " + Observacion; } else { _detCbteCble_Info.IdCtaCble = Categoria.IdCtaCtble_Inve; _detCbteCble_Info.dc_Observacion = Observacion; } _detCbteCble_Info.IdEmpresa = param.IdEmpresa; _detCbteCble_Info.IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion; _detCbteCble_Info.dc_Valor = Convert.ToDouble(item.di_subtotal) + (Obj.TotGastosImp / contItems); // debe LstCbteCble.Add(_detCbteCble_Info); } ct_Cbtecble_det_Info obj2 = new ct_Cbtecble_det_Info(); obj2.IdCtaCble = Obj.IdCtaCble_import; obj2.dc_Observacion = Observacion;//"Contabilizacion por Importacion Diario Importacion FOB" + Obj.ci_Observacion; obj2.IdCtaCble = Obj.IdCtaCble_import; obj2.IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion; obj2.IdEmpresa = Obj.IdEmpresa; obj2.dc_Valor = Obj.TotalLiquidacion * -1; //haber LstCbteCble.Add(obj2); // cabecer ade diario CbteCble_I.IdEmpresa = param.IdEmpresa; CbteCble_I.IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion; CbteCble_I.CodCbteCble = "IM"; CbteCble_I.IdPeriodo = Per_I.IdPeriodo; CbteCble_I.cb_Fecha = Obj.ci_fecha_liquidacion; CbteCble_I.cb_Observacion = Observacion;// "Cont. de la Importacion #" + Obj.CodOrdenCompraExt + " Diario FOB" + Obj.ci_Observacion + Categoria.ca_Categoria; CbteCble_I.Secuencia = 0; CbteCble_I.Estado = "A"; CbteCble_I.Anio = Obj.ci_fecha.Year; CbteCble_I.Mes = Obj.ci_fecha.Month; CbteCble_I.IdUsuario = param.IdUsuario; CbteCble_I.IdUsuarioUltModi = param.IdUsuario; CbteCble_I.cb_FechaTransac = param.GetDateServer(); CbteCble_I.cb_FechaUltModi = param.GetDateServer(); CbteCble_I.Mayorizado = "N"; CbteCble_I.cb_Valor = Obj.TotalLiquidacion; CbteCble_I._cbteCble_det_lista_info = LstCbteCble; Buscbte.GrabarDB(CbteCble_I, ref idCbteCble, ref MensajeError); IdCbteLiquidacion = idCbteCble; ordCompraxCbte_info.ct_IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion; ordCompraxCbte_info.ct_IdCbteCble = idCbteCble; ordCompraxCbte_info.TipoReg = "LQUI"; BusOrdxCbt.GuardarDB(ordCompraxCbte_info, ref MensajeError); var DiarioLiqui = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI"); var Diario_Reverso = BusReverso.Get_Info_cbtecble_Reversado(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte); var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje); Obj.CodCbteCble = CobteLiquidacion.CodCbteCble.ToString(); return(oData.Liquidar(Obj, ref mensaje)); } break; case Cl_Enumeradores.eTipo_action.Anular: decimal IdComprobanteAnulado = 0; string msj = ""; if (IdCbteLiquidacion == 0) { var DiarioLiqui = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI"); var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje); IdCbteLiquidacion = CobteLiquidacion.IdCbteCble; } string motiAnulacion = Obj.motiAnulacion; if (Buscbte.ReversoCbteCble(param.IdEmpresa, IdCbteLiquidacion, tip.IdTipoCbte_DiarioLiquidacion, tip.IdTipoCbte_DiarioLiquidacion_Anul, ref IdComprobanteAnulado, ref msj, param.IdUsuario, motiAnulacion)) { // MessageBox.Show("Anulado"); mensaje = "*** Anulado ***"; ordCompraxCbte_info.ct_IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion_Anul; ordCompraxCbte_info.ct_IdCbteCble = IdComprobanteAnulado; ordCompraxCbte_info.TipoReg = "ALQUI"; BusOrdxCbt.GuardarDB(ordCompraxCbte_info, ref msj); var DiarioLiqui = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI"); var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje); var Diario_Reverso = BusReverso.Get_Info_cbtecble_Reversado(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte); if (Diario_Reverso.IdTipoCbte_Anu != 0) { var CobteLiquidacionAnulado = Buscbte.Get_Info_CbteCble(param.IdEmpresa, Diario_Reverso.IdTipoCbte_Anu, Diario_Reverso.IdCbteCble_Anu, ref mensaje); Obj.msgAnuladoReverso = "**Anulado ** Reversado Con diario" + "\n" + CobteLiquidacionAnulado.CodCbteCble; } return(oData.Liquidar(Obj, ref mensaje)); } break; default: break; } 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("", "Liquidar", ex.Message), ex) { EntityType = typeof(imp_ordencompra_ext_Bus) }; } }