示例#1
0
        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);
        }
示例#2
0
        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;
            }
        }