private void gw_Liquidacion_detalle_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { Info_Liqui_Det = new fa_liquidacion_gastos_det_Info(); Info_Liqui_Det = (fa_liquidacion_gastos_det_Info)this.gw_Liquidacion_detalle.GetFocusedRow(); precio = Math.Round(Convert.ToDouble(gw_Liquidacion_detalle.GetFocusedRowCellValue(col_precio)), 2); cantidad = Math.Round(Convert.ToDouble(gw_Liquidacion_detalle.GetFocusedRowCellValue(col_cantidad)), 2); subtotal = Math.Round((precio * cantidad), 2); if (e.Column == col_cantidad || e.Column == col_precio) { gw_Liquidacion_detalle.SetFocusedRowCellValue(col_subtotal, subtotal); if (Convert.ToBoolean(gw_Liquidacion_detalle.GetFocusedRowCellValue(col_aplica_iva)) == true) { gw_Liquidacion_detalle.SetFocusedRowCellValue(col_valor_iva, (subtotal * param.iva.porcentaje) / 100); iva = (subtotal * param.iva.porcentaje) / 100; } else { gw_Liquidacion_detalle.SetFocusedRowCellValue(col_valor_iva, 0); iva = 0; } gw_Liquidacion_detalle.SetFocusedRowCellValue(col_por_iva, param.iva); gw_Liquidacion_detalle.SetFocusedRowCellValue(col_Total_liq, subtotal + iva); } if (e.Column == col_aplica_iva) { if (Convert.ToBoolean(gw_Liquidacion_detalle.GetFocusedRowCellValue(col_aplica_iva)) == true) { gw_Liquidacion_detalle.SetFocusedRowCellValue(col_valor_iva, (subtotal * param.iva.porcentaje) / 100); iva = (subtotal * param.iva.porcentaje) / 100; } else { iva = 0; gw_Liquidacion_detalle.SetFocusedRowCellValue(col_valor_iva, 0); } gw_Liquidacion_detalle.SetFocusedRowCellValue(col_por_iva, param.iva); gw_Liquidacion_detalle.SetFocusedRowCellValue(col_Total_liq, subtotal + iva); } } 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 bool GuardarDB(fa_liquidacion_gastos_det_Info Info, ref string mensaje) { try { return(oData.GuardarDB(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 List <fa_liquidacion_gastos_det_Info> Get_List_Liquidacion_Gastos_Det_Historico(int IdEmpresa, decimal IdLiquidacion, ref string mensaje) { try { List <fa_liquidacion_gastos_det_Info> Lista = new List <fa_liquidacion_gastos_det_Info>(); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { var contact = from q in Context.vwfa_liquidacion_gastos_det_Historico where q.IdEmpresa == IdEmpresa && q.IdLiquidacion == IdLiquidacion select q; foreach (var item in contact) { fa_liquidacion_gastos_det_Info Info = new fa_liquidacion_gastos_det_Info(); Info.IdEmpresa = item.IdEmpresa; Info.IdLiquidacion = item.IdLiquidacion; Info.secuencia = item.secuencia; Info.IdProducto_Liqui = item.IdProducto_Liqui; Info.detalle_x_producto = item.detalle_x_producto; Info.cantidad = item.cantidad; Info.precio = item.precio; Info.subtotal = item.subtotal; Info.aplica_iva = item.aplica_iva; Info.por_iva = item.por_iva; Info.valor_iva = item.valor_iva; Info.Total_liq = item.Total_liq; Info.nom_producto_Liqui = item.nom_producto_Liqui; Info.IdProducto = item.IdProducto; 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()); } }
public bool GuardarDB(fa_liquidacion_gastos_det_Info Info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_liquidacion_gastos_det_Historico contact = new fa_liquidacion_gastos_det_Historico(); contact.IdEmpresa = Info.IdEmpresa; contact.IdLiquidacion = Info.IdLiquidacion; contact.secuencia = Info.secuencia; contact.IdProducto_Liqui = Info.IdProducto_Liqui; contact.detalle_x_producto = Info.detalle_x_producto; contact.cantidad = Info.cantidad; contact.precio = Info.precio; contact.subtotal = Info.subtotal; contact.aplica_iva = Info.aplica_iva; contact.por_iva = Info.por_iva; contact.valor_iva = Info.valor_iva; contact.Total_liq = Info.Total_liq; Context.fa_liquidacion_gastos_det_Historico.Add(contact); 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()); } }