public void Get() { try { // var imp = busImpOrdenExt.obtenerOrdenCompra(param.IdEmpresa,txtImportacion.Text,(int)cmbSucursal.SelectedValue); _Info = new imp_ordencompra_ext_x_imp_gastosxImport_Info(); _Info.IdEmpresa = param.IdEmpresa; _Info.IdOrdenCompraExt = Convert.ToDecimal(searchLookUpEditImportacion.EditValue); _Info.IdBanco = Convert.ToInt32(cmbBanco.EditValue); _Info.IdTipoCbte = tipocbte.IdTipoCbte; //_Info.IdSucusal = 1; // imp_ordencompra_ext_Info imp = (imp_ordencompra_ext_Info)searchLookUpEditImportacion.GetSelectedDataRow(); var idSucursa = Importaciones.Find(var => var.IdOrdenCompraExt == _Info.IdOrdenCompraExt).IdSucusal; _Info.IdSucusal = idSucursa; _Info.Fecha = Convert.ToDateTime(dtpFecha.Value.ToShortDateString()); _Info.CodDocu_Pago = cmbTipoPagos.SelectedValue.ToString(); _Info.Observacion = txtObservacion.Text; 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) { asd.Secuencia = i + 1; asd.IdEmpresa = param.IdEmpresa; asd.IdOrdenCompraExt = _Info.IdOrdenCompraExt; asd.IdSucusal = _Info.IdSucusal; _Info.ListaGastos.Add(asd); } } if (_Info.CodDocu_Pago != "PROVI") { _Info.IdProveedor = Convert.ToDecimal(this.searchLookUpEdit_Proveedor.EditValue); } else { _Info.IdProveedor = null; } //_Info.IdRegistroGasto = Convert.ToDecimal(txtIdRegistroGasto.Text); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }
public List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info> Get_List_ordencompra_ext_x_imp_gastosxImport_Det_x_OC(imp_ordencompra_ext_Info Info) { List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info> lst = new List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info>(); EntitiesImportacion IMP = new EntitiesImportacion(); try { var Consu = from q in IMP.imp_ordencompra_ext_x_imp_gastosxImport_det from d in IMP.vwImp_GastosImportacion where q.IdEmpresa == Info.IdEmpresa && q.IdSucursal == Info.IdSucusal && q.IdOrdenCompraExt == Info.IdOrdenCompraExt && q.IdEmpresa == d.IdEmpresa && q.IdSucursal == d.IdSucusal && q.IdOrdenCompraExt == d.IdOrdenCompraExt && q.IdRegistroGasto == d.IdRegistroGasto && d.Estado == "A" select new { d.Observacion, q.IdEmpresa, q.Valor, d.IdRegistroGasto, q.IdSucursal, q.IdOrdenCompraExt, q.Secuencia, q.IdGastoImp, d.ba_descripcion, d.pr_nombre, d.Fecha, d.CodDocu_Pago }; foreach (var item in Consu) { imp_ordencompra_ext_x_imp_gastosxImport_Det_Info obj = new imp_ordencompra_ext_x_imp_gastosxImport_Det_Info(); obj.Banco = item.ba_descripcion; obj.Proveedor = item.pr_nombre; obj.IdEmpresa = item.IdEmpresa; obj.IdRegistroGasto = item.IdRegistroGasto; obj.IdSucusal = item.IdSucursal; obj.IdOrdenCompraExt = item.IdOrdenCompraExt; obj.Secuencia = item.Secuencia; obj.IdGastoImp = item.IdGastoImp; obj.Valor = item.Valor; obj.Fecha = item.Fecha; obj.Observacion = item.Observacion; obj.CodDocu_Pago = item.CodDocu_Pago; 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()); } }
public List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info> Get_List_ordencompra_ext_x_imp_gastosxImport_Det(imp_ordencompra_ext_x_imp_gastosxImport_Info Info) { List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info> lst = new List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info>(); EntitiesImportacion IMP = new EntitiesImportacion(); try { var Consu = from q in IMP.imp_ordencompra_ext_x_imp_gastosxImport_det where q.IdEmpresa == Info.IdEmpresa && q.IdSucursal == Info.IdSucusal && q.IdRegistroGasto == Info.IdRegistroGasto && q.IdOrdenCompraExt == Info.IdOrdenCompraExt select q; foreach (var item in Consu) { imp_ordencompra_ext_x_imp_gastosxImport_Det_Info obj = new imp_ordencompra_ext_x_imp_gastosxImport_Det_Info(); obj.IdEmpresa = item.IdEmpresa; obj.IdRegistroGasto = item.IdRegistroGasto; obj.IdSucusal = item.IdSucursal; obj.IdOrdenCompraExt = item.IdOrdenCompraExt; obj.Secuencia = item.Secuencia; obj.IdGastoImp = item.IdGastoImp; obj.Valor = item.Valor; 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()); } }
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 GenerarDiario(int IdEmpresa, int IdSucursal, decimal IdRegistroGasto, ref string msg, ref decimal idCbteCble, ref string CodTipod) { try{ #region Declaracion ct_Periodo_Info Per_I = new ct_Periodo_Info(); ct_Cbtecble_Info CbteCble_I = new ct_Cbtecble_Info(); List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info> ListaDetalle = new List <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info>(); imp_gastosximport_x_empresa_Data BusGastosXEmpresa = new imp_gastosximport_x_empresa_Data(); List <imp_gastosximport_x_empresa_Info> lstGastosXEmpresa = new List <imp_gastosximport_x_empresa_Info>(); List <imp_ordencompra_ext_x_imp_gastosxImport_Info> Lst = new List <imp_ordencompra_ext_x_imp_gastosxImport_Info>(); imp_ordencompra_ext_x_imp_gastosxImport_Info _Info = new imp_ordencompra_ext_x_imp_gastosxImport_Info(); int IdTipoCbte = 0; ba_Cbte_Ban_Bus BusCbteBanco = new ba_Cbte_Ban_Bus(); ct_Periodo_Data Per_B = new ct_Periodo_Data(); List <ct_Cbtecble_det_Info> LstCbteCble = new List <ct_Cbtecble_det_Info>(); cl_parametrosGenerales_Bus param = cl_parametrosGenerales_Bus.Instance; ba_Cbte_Ban_Info CbteBan_I = new ba_Cbte_Ban_Info(); string MensajeError = ""; #endregion #region ObtenerGastoImportacion Lst = Get_List_ordencompra_ext_x_imp_gastosxImport_Para_Contabilizar(IdEmpresa, IdSucursal, IdRegistroGasto); foreach (var item in Lst) { _Info.IdOrdenCompraExt = item.IdOrdenCompraExt; _Info.IdProveedor = item.IdProveedor; _Info.IdEmpresa = item.IdEmpresa; _Info.IdSucusal = item.IdSucusal; _Info.IdRegistroGasto = item.IdRegistroGasto; _Info.Observacion = item.Observacion; _Info.IdCtaCble_Banco = item.IdCtaCble_Banco; _Info.IdBanco = item.IdBanco; _Info.CodOrdenCompraExt = item.CodOrdenCompraExt; IdTipoCbte = item.IdTipoCbte; _Info.Fecha = item.Fecha; _Info.IdCtaCble_Importacion = item.IdCtaCble_Importacion; imp_ordencompra_ext_x_imp_gastosxImport_Det_Info Det = new imp_ordencompra_ext_x_imp_gastosxImport_Det_Info(); Det.IdGastoImp = item.IdGastoImp; Det.Valor = item.Valor; _Info.ListaGastos.Add(Det); } #endregion Per_I = Per_B.Get_Info_Periodo(_Info.IdEmpresa, _Info.Fecha, ref MensajeError); lstGastosXEmpresa = BusGastosXEmpresa.Get_List_gastosximport_x_empresa(IdEmpresa); var DatosDiario = from p in _Info.ListaGastos join w in lstGastosXEmpresa on new { p.IdGastoImp } equals new { w.IdGastoImp } select new { p.IdGastoImp, w.IdCtaCble, p.Valor, w.debCre_Provicion, w.debcre_DebBanco }; if (DatosDiario.ToList().Count != _Info.ListaGastos.Count) { msg = "No existen parametros contables verifique que los parametros Contables Esten Llenados correctametne /n Comunicarce Cons sistemas"; return(false); } #region CbteCble_Detalle foreach (var item in DatosDiario) { ct_Cbtecble_det_Info obj = new ct_Cbtecble_det_Info(); obj.dc_Observacion = "Cont. X gastos De Imp " + _Info.CodOrdenCompraExt + " / " + _Info.IdOrdenCompraExt + " / " + _Info.Observacion + " / " + Get_Descripcion(item.IdGastoImp); obj.IdCtaCble = item.IdCtaCble; obj.IdTipoCbte = IdTipoCbte; obj.IdEmpresa = _Info.IdEmpresa; if (CodTipod == "DEBBAN") { if (item.debcre_DebBanco == "C") { obj.dc_Valor = item.Valor * -1; } else { obj.dc_Valor = item.Valor; } } if (CodTipod == "PROVI") { if (item.debcre_DebBanco == "D") { obj.dc_Valor = item.Valor * -1; } else { obj.dc_Valor = item.Valor; } } LstCbteCble.Add(obj); } ct_Cbtecble_det_Info obj2 = new ct_Cbtecble_det_Info(); double Valor = 0; foreach (var item in _Info.ListaGastos) { Valor = Valor + item.Valor; } obj2.dc_Observacion = "Cont. X gastos De Imp " + _Info.CodOrdenCompraExt + " / " + _Info.IdOrdenCompraExt + " / " + _Info.Observacion + " / Importacion"; obj2.IdCtaCble = _Info.IdCtaCble_Banco; obj2.IdTipoCbte = IdTipoCbte; obj2.IdEmpresa = _Info.IdEmpresa; ba_Banco_Cuenta_Bus B_banco = new ba_Banco_Cuenta_Bus(); var Banco = B_banco.Get_Info_Banco_Cuenta(param.IdEmpresa, _Info.IdBanco); if (CodTipod == "DEBBAN") { obj2.IdCtaCble = Banco.IdCtaCble; obj2.dc_Valor = Valor * -1; } if (CodTipod == "PROVI") { obj2.IdCtaCble = _Info.IdCtaCble_Importacion; obj2.dc_Valor = Valor; } LstCbteCble.Add(obj2); #endregion #region CbteCble CbteCble_I.IdEmpresa = _Info.IdEmpresa; CbteCble_I.IdTipoCbte = IdTipoCbte; CbteCble_I.IdPeriodo = Per_I.IdPeriodo; CbteCble_I.cb_Fecha = Convert.ToDateTime(_Info.Fecha.ToShortDateString()); CbteCble_I.cb_Valor = Valor; if (CodTipod == "DEBBAN") { CbteCble_I.CodCbteCble = "DEBBAN"; } if (CodTipod == "PROVI") { CbteCble_I.CodCbteCble = "PROVI"; } CbteCble_I.cb_Observacion = "Cont. X Imp. " + _Info.CodOrdenCompraExt + " / " + _Info.IdOrdenCompraExt + "Gastos de Importacion. / " + _Info.Observacion; CbteCble_I.Secuencia = 0; CbteCble_I.Estado = "A"; CbteCble_I.Anio = _Info.Fecha.Year; CbteCble_I.Mes = _Info.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._cbteCble_det_lista_info = LstCbteCble; // decimal idCbteCble = 0; string cod_CbteCble = ""; ct_Cbtecble_Bus CbteCble_B = new ct_Cbtecble_Bus(); if (CbteCble_B.GrabarDB(CbteCble_I, ref idCbteCble, ref msg) == false) { return(false); } oData.ModificarDB(_Info, idCbteCble); #endregion if (CodTipod == "DEBBAN") { #region CbteBan_I CbteBan_I.IdEmpresa = param.IdEmpresa; CbteBan_I.IdTipocbte = IdTipoCbte; CbteBan_I.IdCbteCble = idCbteCble; CbteBan_I.Cod_Cbtecble = cod_CbteCble; CbteBan_I.IdPeriodo = Per_I.IdPeriodo; CbteBan_I.IdBanco = _Info.IdBanco; CbteBan_I.cb_Fecha = Convert.ToDateTime(_Info.Fecha.ToShortDateString()); CbteBan_I.cb_Observacion = _Info.Observacion.Trim(); CbteBan_I.cb_Valor = Valor; CbteBan_I.Estado = "A"; CbteBan_I.IdUsuario = param.IdUsuario; CbteBan_I.IdUsuario_Anu = param.IdUsuario; CbteBan_I.FechaAnulacion = param.Fecha_Transac; CbteBan_I.Fecha_Transac = param.Fecha_Transac; CbteBan_I.Fecha_UltMod = param.Fecha_Transac; CbteBan_I.IdUsuarioUltMod = param.IdUsuario; CbteBan_I.ip = param.ip; CbteBan_I.nom_pc = param.nom_pc; if (BusCbteBanco.GrabarDB(CbteBan_I, ref MensajeError) == false) { return(false); } #endregion } imp_ordencompra_ext_x_ct_cbtecble_Data DataOrdxCbt = new imp_ordencompra_ext_x_ct_cbtecble_Data(); imp_ordencompra_ext_x_ct_cbtecble_Info ordCompraxCbte_info = new imp_ordencompra_ext_x_ct_cbtecble_Info(); ordCompraxCbte_info.ct_IdEmpresa = ordCompraxCbte_info.imp_IdEmpresa = _Info.IdEmpresa; ordCompraxCbte_info.imp_IdOrdenCompraExt = _Info.IdOrdenCompraExt; ordCompraxCbte_info.imp_IdSucusal = _Info.IdSucusal; ordCompraxCbte_info.ct_IdTipoCbte = IdTipoCbte; ordCompraxCbte_info.ct_IdCbteCble = idCbteCble; ordCompraxCbte_info.TipoReg = "Gast"; DataOrdxCbt.GuardarDB(ordCompraxCbte_info, 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("", "GenerarDiario", ex.Message), ex) { EntityType = typeof(imp_ordencompra_ext_x_imp_gastosxImport_Bus) }; } }