void SetAllDebtCreditBtn(MyAccVoucherRow row) { SetDebtCredit(row.IsDebt0, btnCD0, money0TextBox); SetDebtCredit(row.IsDebt1, btnCD1, money1TextBox); SetDebtCredit(row.IsDebt2, btnCD2, money2TextBox); SetDebtCredit(row.IsDebt3, btnCD3, money3TextBox); }
object DebtTotal(MyAccVoucherRow row) { if (row.IsIsDebt0Null()) { return(null); } decimal debt = 0m, credit = 0m; if (!row.IsMoney0Null() && !row.IsTitleCode0Null()) { if (row.IsDebt0) { debt += row.Money0; } else { credit += row.Money0; } } if (!row.IsMoney1Null() && !row.IsTitleCode1Null()) { if (row.IsDebt1) { debt += row.Money1; } else { credit += row.Money1; } } if (!row.IsMoney2Null() && !row.IsTitleCode2Null()) { if (row.IsDebt2) { debt += row.Money2; } else { credit += row.Money2; } } if (!row.IsMoney3Null() && !row.IsTitleCode3Null()) { if (row.IsDebt3) { debt += row.Money3; } else { credit += row.Money3; } } if (credit != debt) { return(null); } return(debt); }
void CalcTotal(MyAccVoucherRow row) { decimal debt = 0m, credit = 0m; if (!row.IsMoney0Null()) { if (row.IsDebt0) { debt += row.Money0; } else { credit += row.Money0; } } if (!row.IsMoney1Null()) { if (row.IsDebt1) { debt += row.Money1; } else { credit += row.Money1; } } if (!row.IsMoney2Null()) { if (row.IsDebt2) { debt += row.Money2; } else { credit += row.Money2; } } if (!row.IsMoney3Null()) { if (row.IsDebt3) { debt += row.Money3; } else { credit += row.Money3; } } labelCreditTotal.Text = credit.ToString(); labelDebtTotal.Text = debt.ToString(); if (credit != debt) { labelDebtTotal.ForeColor = Color.Red; labelCreditTotal.ForeColor = Color.Red; } else { labelDebtTotal.ForeColor = SystemColors.ControlText; labelCreditTotal.ForeColor = SystemColors.ControlText; } }