public bool AnularDB(fa_liquidacion_gastos_Info Info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_liquidacion_gastos contact = Context.fa_liquidacion_gastos.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdLiquidacion == Info.IdLiquidacion); if (contact != null) { contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu; contact.Fecha_UltAnu = Info.Fecha_UltAnu; contact.MotivoAnulacion = Info.MotivoAnulacion; contact.estado = "I"; Context.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()); } }
private void gw_Liquidacion_Gastos_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { Info_Liquidacion = gw_Liquidacion_Gastos.GetRow(e.FocusedRowHandle) as fa_liquidacion_gastos_Info; } 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 List <fa_liquidacion_gastos_Info> Get_List_Liquidacion_Gastos(int IdEmpresa, DateTime FechaIni, DateTime FechaFin, ref string mensaje) { try { DateTime Fecha_Ini = Convert.ToDateTime(FechaIni.ToShortDateString()); DateTime Fecha_Fin = Convert.ToDateTime(FechaFin.ToShortDateString()); List <fa_liquidacion_gastos_Info> Lista = new List <fa_liquidacion_gastos_Info>(); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { var lst = from q in Context.vwfa_liquidacion_gastos where q.IdEmpresa == IdEmpresa && q.fecha_liqui >= Fecha_Ini && q.fecha_liqui <= Fecha_Fin select q; foreach (var item in lst) { fa_liquidacion_gastos_Info Info = new fa_liquidacion_gastos_Info(); Info.IdEmpresa = item.IdEmpresa; Info.IdLiquidacion = item.IdLiquidacion; Info.IdPeriodo = item.IdPeriodo; Info.cod_liquidacion = item.cod_liquidacion; Info.IdCliente = item.IdCliente; Info.fecha_liqui = item.fecha_liqui; Info.Observacion = item.Observacion; Info.estado = item.estado; Info.IdUsuario = item.IdUsuario; Info.pe_apellido = item.pe_apellido; Info.pe_razonSocial = item.pe_razonSocial; Info.pe_nombre = item.pe_nombre; Info.pe_cedulaRuc = item.pe_cedulaRuc; Info.pe_direccion = item.pe_direccion; Info.pe_telefonoCasa = item.pe_telefonoCasa; 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 mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }
private void gridView_detalleGastos_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { try { liquidacion_gasto_info = new fa_liquidacion_gastos_Info(); liquidacion_gasto_info = (fa_liquidacion_gastos_Info)gridView_detalleGastos.GetFocusedRow(); } 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 EliminarDB(fa_liquidacion_gastos_Info Info, ref string mensaje) { try { return(oData.EliminarDB(Info, ref mensaje)); } catch (Exception ex) { mensaje = ex.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(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public void Set_Info(fa_liquidacion_gastos_Info _Info_Liquidacion) { try { Info_Liquidacion = _Info_Liquidacion; } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; NameMetodo = NameMetodo + " - " + ex.ToString(); MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
public fa_liquidacion_gastos_Info Get_Info_Liquidacion_Gastos(int IdEmpresa, decimal IdLiquidacion_Gastos, ref string mensaje) { try { fa_liquidacion_gastos_Info Info = new fa_liquidacion_gastos_Info(); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { var lst = from q in Context.vwfa_liquidacion_gastos where q.IdEmpresa == IdEmpresa && q.IdLiquidacion == IdLiquidacion_Gastos select q; foreach (var item in lst) { Info.IdEmpresa = item.IdEmpresa; Info.IdLiquidacion = item.IdLiquidacion; Info.IdPeriodo = item.IdPeriodo; Info.cod_liquidacion = item.cod_liquidacion; Info.IdCliente = item.IdCliente; Info.fecha_liqui = item.fecha_liqui; Info.Observacion = item.Observacion; Info.estado = item.estado; Info.IdUsuario = item.IdUsuario; Info.pe_apellido = item.pe_apellido; Info.pe_razonSocial = item.pe_razonSocial; Info.pe_nombre = item.pe_nombre; Info.pe_cedulaRuc = item.pe_cedulaRuc; Info.pe_direccion = item.pe_direccion; Info.pe_telefonoCasa = item.pe_telefonoCasa; fa_liquidacion_gastos_det_Data Odata_det = new fa_liquidacion_gastos_det_Data(); Info.Lis_Detalle = Odata_det.Get_List_Liquidacion_Gastos_Det(Info.IdEmpresa, Info.IdLiquidacion, ref mensaje); } } return(Info); } 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()); } }
public bool GuardarDB(fa_liquidacion_gastos_Info Info, ref decimal IdLiquidacion, ref string mensaje) { try { IdLiquidacion = Get_Id(Info.IdEmpresa, ref mensaje); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_liquidacion_gastos contact = new fa_liquidacion_gastos(); contact.IdEmpresa = Info.IdEmpresa; contact.IdLiquidacion = Info.IdLiquidacion = IdLiquidacion; contact.IdPeriodo = Info.IdPeriodo; contact.cod_liquidacion = Info.cod_liquidacion; contact.IdCliente = Info.IdCliente; contact.fecha_liqui = Info.fecha_liqui; contact.Observacion = Info.Observacion; contact.estado = Info.estado; contact.IdUsuario = Info.IdUsuario; contact.Fecha_Transaccion = Info.Fecha_Transaccion; contact.nom_pc = Info.nom_pc; contact.ip = Info.ip; Context.fa_liquidacion_gastos.Add(contact); Context.SaveChanges(); } foreach (var item in Info.Lis_Detalle) { item.IdEmpresa = Info.IdEmpresa; item.IdLiquidacion = Info.IdLiquidacion; } oData_Det.GuardarDB(Info.Lis_Detalle, ref mensaje); 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()); } }
public bool ModificarDB(fa_liquidacion_gastos_Info Info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_liquidacion_gastos contact = Context.fa_liquidacion_gastos.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdLiquidacion == Info.IdLiquidacion); if (contact != null) { contact.IdEmpresa = Info.IdEmpresa; contact.IdLiquidacion = Info.IdLiquidacion; contact.IdPeriodo = Info.IdPeriodo; contact.cod_liquidacion = Info.cod_liquidacion; contact.IdCliente = Info.IdCliente; contact.fecha_liqui = Info.fecha_liqui; contact.Observacion = Info.Observacion; contact.estado = "A"; contact.IdUsuarioUltModi = Info.IdUsuarioUltModi; contact.Fecha_UltMod = DateTime.Now; contact.nom_pc = Info.nom_pc; contact.ip = Info.ip; Context.SaveChanges(); } } oData_Det.EliminarDB(Info, ref mensaje); foreach (var item in Info.Lis_Detalle) { item.IdEmpresa = Info.IdEmpresa; item.IdLiquidacion = Info.IdLiquidacion; } oData_Det.GuardarDB(Info.Lis_Detalle, ref mensaje); 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()); } }
public List <fa_liquidacion_gastos_Info> Get_List_Liquidacion_Gastos_x_periodo(int IdEmpresa, int idperiodo) { try { List <fa_liquidacion_gastos_Info> Lista = new List <fa_liquidacion_gastos_Info>(); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { var lst = from q in Context.vwfa_liquidaciones_group_x_liqui_x_periodo_x_cliente where q.IdEmpresa == IdEmpresa && q.IdPeriodo == idperiodo select q; foreach (var item in lst) { fa_liquidacion_gastos_Info Info = new fa_liquidacion_gastos_Info(); Info.IdEmpresa = item.IdEmpresa; Info.IdLiquidacion = item.IdLiquidacion; Info.IdPeriodo = item.IdPeriodo; Info.cod_liquidacion = item.cod_liquidacion; Info.IdCliente = item.IdCliente; Info.fecha_liqui = item.fecha_liqui; Info.Observacion = item.Observacion; Info.pe_nombre = item.pe_nombreCompleto; Info.Subtotal = item.Subtotal; Info.Iva = item.Iva; Info.total_liquidacion = item.total_liquidacion; 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); throw new Exception(ex.ToString()); } }
public bool EliminarDB(fa_liquidacion_gastos_Info info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { Context.Database.ExecuteSqlCommand("delete Fj_servindustrias.fa_liquidacion_gastos_det where IdEmpresa = " + info.IdEmpresa + " and IdLiquidacion = " + info.IdLiquidacion + " "); } 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()); } }
public bool Convert_Liquidacion_a_Factura(int IdEmpresa, decimal IdLiquidacion_gastos, ref decimal IdCbteVta, ref string mensaje) { try { bool respuesta = false; fa_liquidacion_gastos_Bus Bus_liqu_gastos = new fa_liquidacion_gastos_Bus(); fa_liquidacion_gastos_Info InfoLiqui_Gasto = new fa_liquidacion_gastos_Info(); fa_pre_facturacion_Parametro_Info Info_Pre_fac_param = new fa_pre_facturacion_Parametro_Info(); fa_pre_facturacion_Parametro_Bus Bus_Pre_fac_param = new fa_pre_facturacion_Parametro_Bus(); Info_Pre_fac_param = Bus_Pre_fac_param.Get_Info(IdEmpresa); if (Info_Pre_fac_param.IdSucursal_para_facturar == 0 || Info_Pre_fac_param.IdBodega_para_facturar == 0) { mensaje = "no hay IdSucursal o idbodega para factura en parametros de Liquidacion verifique y configure"; throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "no hay IdSucursal o idbodega para factura en parametros de Liquidacion verifique y configure ", mensaje)) { EntityType = typeof(fa_liquidacion_gastos_Bus) }; } InfoLiqui_Gasto = Bus_liqu_gastos.Get_Info_Liquidacion_Gastos(IdEmpresa, IdLiquidacion_gastos, ref mensaje); if (InfoLiqui_Gasto.Lis_Detalle.Count() == 0) { mensaje = "Liquidacion no tiene detalle"; return(false); } fa_factura_Bus Bus_factura = new fa_factura_Bus(); fa_factura_Info Info_Factura = new fa_factura_Info(); Info_Factura.IdEmpresa = InfoLiqui_Gasto.IdEmpresa; Info_Factura.IdSucursal = Info_Pre_fac_param.IdSucursal_para_facturar; Info_Factura.IdBodega = Info_Pre_fac_param.IdBodega_para_facturar; Info_Factura.vt_tipoDoc = "FACT"; Info_Factura.IdCliente = InfoLiqui_Gasto.IdCliente; Info_Factura.IdVendedor = 1; Info_Factura.vt_fecha = Convert.ToDateTime(DateTime.Now.ToShortDateString()); Info_Factura.vt_fech_venc = Info_Factura.vt_fecha; Info_Factura.vt_plazo = 0; Info_Factura.vt_tipo_venta = "CON"; Info_Factura.vt_Observacion = "Fact x Liqui : " + InfoLiqui_Gasto.Observacion; Info_Factura.IdPeriodo = ((Info_Factura.vt_fecha.Year) * 100) + Info_Factura.vt_fecha.Month; Info_Factura.vt_anio = Info_Factura.vt_fecha.Year; Info_Factura.vt_mes = Info_Factura.vt_fecha.Month; Info_Factura.Estado = "A"; Info_Factura.IdCaja = 1; List <fa_factura_det_info> list_det_factura = new List <fa_factura_det_info>(); foreach (fa_liquidacion_gastos_det_Info item_det in InfoLiqui_Gasto.Lis_Detalle) { fa_factura_det_info Info_det_factura = new fa_factura_det_info(); Info_det_factura.IdEmpresa = Info_Factura.IdEmpresa; Info_det_factura.IdSucursal = Info_Factura.IdSucursal; Info_det_factura.IdBodega = Info_Factura.IdBodega; Info_det_factura.IdCbteVta = 0; Info_det_factura.Secuencia = item_det.secuencia; Info_det_factura.IdProducto = item_det.IdProducto; Info_det_factura.vt_cantidad = item_det.cantidad; Info_det_factura.vt_Precio = item_det.precio; Info_det_factura.vt_PrecioFinal = item_det.precio; Info_det_factura.vt_Subtotal = item_det.subtotal; Info_det_factura.vt_iva = item_det.valor_iva; Info_det_factura.vt_por_iva = item_det.por_iva; Info_det_factura.vt_total = item_det.Total_liq; Info_det_factura.vt_estado = "A"; Info_det_factura.IdCod_Impuesto_Iva = param.iva.IdCod_Impuesto; Info_det_factura.vt_detallexItems = item_det.detalle_x_producto; Info_det_factura.IdPunto_cargo = null; list_det_factura.Add(Info_det_factura); } Info_Factura.DetFactura_List = list_det_factura; string num_doc_x_fac = ""; string mensaje_dupli = ""; respuesta = Bus_factura.GuardarDB(Info_Factura, ref IdCbteVta, ref num_doc_x_fac, ref mensaje, ref mensaje_dupli); return(respuesta); } catch (Exception ex) { 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(), "", "", "", "", "", "", "", DateTime.Now); throw new Exception(); } }