public override void TotalizarDetalle() { object calcObject; double totalDebito = 0.0, totalCredito = 0.0, total = 0.0; try { calcObject = DTDetalle.Compute("Sum(Valor)", "Origen = 'DR'"); if (calcObject != null) { if (calcObject.ToString().Trim() != "") { totalDebito = double.Parse(calcObject.ToString()); } } calcObject = DTDetalle.Compute("Sum(Valor)", "Origen = 'CR'"); if (calcObject != null) { if (calcObject.ToString().Trim() != "") { totalCredito = double.Parse(calcObject.ToString()); } } total = totalDebito - totalCredito; lblTotal.Text = "TOTAL >>> " + total.ToString("N2"); } catch (Exception) { throw; } }
public override void TotalizarDetalle() { object calcObject; double totalInteres = 0; double totalDemora = 0; double totalOtros = 0; try { //base.TotalizarDetalle(); calcObject = DTDetalle.Compute("Sum(D_Interes)", ""); if (calcObject != null) { if (calcObject.ToString().Trim() != "") { totalInteres = double.Parse(calcObject.ToString()); } } calcObject = DTDetalle.Compute("Sum(D_Demora)", ""); if (calcObject != null) { if (calcObject.ToString().Trim() != "") { totalDemora = double.Parse(calcObject.ToString()); } } calcObject = DTDetalle.Compute("Sum(D_Otros)", ""); if (calcObject != null) { if (calcObject.ToString().Trim() != "") { totalOtros = double.Parse(calcObject.ToString()); } } total = totalInteres + totalDemora + totalOtros; SetValorEncabezado("Total_Interes", totalInteres); SetValorEncabezado("Total_Demora", totalDemora); SetValorEncabezado("Total_Otros", totalOtros); SetValorEncabezado("Total", total); lblTotalInteres.Text = totalInteres.ToString("C2"); lblTotalDemora.Text = totalDemora.ToString("C2"); lblTotalOtros.Text = totalOtros.ToString("C2"); lblTotal.Text = total.ToString("C2"); } catch (Exception ex) { objUtil.MostrarMensajeError("Error al Totalizar, " + ex.Message); } }
public override void TotalizarDetalle() { object calcObject; double totalDebito = 0; double totalCredito = 0; double diferencia = 0; try { //base.TotalizarDetalle(); calcObject = DTDetalle.Compute("Sum(Debito)", "itemNumero > 0"); if (calcObject != null) { if (calcObject.ToString().Trim() != "") { totalDebito = double.Parse(calcObject.ToString()); } } calcObject = DTDetalle.Compute("Sum(Credito)", "itemNumero > 0"); if (calcObject != null) { if (calcObject.ToString().Trim() != "") { totalCredito = double.Parse(calcObject.ToString()); } } diferencia = totalDebito - totalCredito; SetValorEncabezado("Monto", totalDebito); SetValorEncabezado("Total_Debito", totalDebito); SetValorEncabezado("Total_Credito", totalCredito); SetValorEncabezado("Diferencia", diferencia); lblTotalDebito.Text = totalDebito.ToString("N2"); lblTotalCredito.Text = totalCredito.ToString("N2"); lblDiferencia.Text = diferencia.ToString("N2"); } catch (Exception) { throw; } finally { calcObject = null; } }