Files
zszq-trs/YLErpDAL/Model/FinancialVoucherCreator/MaturityInvestmentIncomeGenerator.cs
T
2024-05-09 14:06:26 +08:00

321 lines
16 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using YLErp.Model.Enum;
namespace YLErp.Model.FinancialVoucherCreator
{
public class MaturityInvestmentIncomeGenerator
{
public static FinancialStatement GetFinancialStatement(bool isSamePeer, string clientName, bool isBuy, string contractCode, bool isExercise, double optionFee, double exerciseAmount)
{
if (isSamePeer)
{
if (isBuy)
{
var settlement = exerciseAmount - optionFee;
if (!isExercise)
{
var financialStatement = new FinancialStatement
{
AbstractTye = FinancialVoucherAbstractEnum.MaturityInvestmentIncome.GetHashCode(),
Abstract = $"确认期权到期投资收益({contractCode}",
IsSamePeer = isSamePeer
};
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/买权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 0,
DataField = settlement,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "衍生工具/期权/场外期权/买权/成本",
DebitOrCredit = 1,
DataField = settlement,
Remark = ""
});
return financialStatement;
}
else
{
var financialStatement = new FinancialStatement
{
AbstractTye = FinancialVoucherAbstractEnum.MaturityInvestmentIncome.GetHashCode(),
Abstract = $"确认期权到期投资收益({contractCode}",
IsSamePeer = isSamePeer
};
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应付款/应付单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 0,
DataField = optionFee,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "衍生工具/期权/场外期权/买权/成本",
DebitOrCredit = 1,
DataField = optionFee,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/买权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 0,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应付款/应付单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 1,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应收款/应收单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 0,
DataField = Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/买权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 1,
DataField = Math.Abs(settlement),
Remark = ""
});
return financialStatement;
}
}
else
{
var settlement = exerciseAmount + optionFee;
if (!isExercise)
{
var financialStatement = new FinancialStatement
{
AbstractTye = FinancialVoucherAbstractEnum.MaturityInvestmentIncome.GetHashCode(),
Abstract = $"确认期权到期投资收益({contractCode}",
IsSamePeer = isSamePeer
};
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "衍生工具/期权/场外期权/卖权/成本",
DebitOrCredit = 0,
DataField = settlement,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/卖权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 1,
DataField = settlement,
Remark = ""
});
return financialStatement;
}
else
{
var financialStatement = new FinancialStatement
{
AbstractTye = FinancialVoucherAbstractEnum.MaturityInvestmentIncome.GetHashCode(),
Abstract = $"确认期权到期投资收益({contractCode}",
IsSamePeer = isSamePeer
};
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "衍生工具/期权/场外期权/卖权/成本",
DebitOrCredit = 0,
DataField = optionFee,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应收款/应收单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 1,
DataField = optionFee,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/卖权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 0,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应付款/应付单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 1,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应收款/应收单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 0,
DataField = Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/卖权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 1,
DataField = Math.Abs(settlement),
Remark = ""
});
return financialStatement;
}
}
}
else
{
if (isBuy)
{
var settlement = exerciseAmount - optionFee;
var financialStatement = new FinancialStatement
{
AbstractTye = FinancialVoucherAbstractEnum.MaturityInvestmentIncome.GetHashCode(),
Abstract = $"确认期权到期投资收益({contractCode}",
IsSamePeer = isSamePeer
};
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/买权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 0,
DataField = optionFee,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "衍生工具/期权/场外期权/买权/成本",
DebitOrCredit = 1,
DataField = optionFee,
Remark = ""
});
if (Math.Abs(settlement) > 0)
{
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/买权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 0,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应付款/应付单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 1,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应收款/应收单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 0,
DataField = Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/卖权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 1,
DataField = Math.Abs(settlement),
Remark = ""
});
}
return financialStatement;
}
else
{
var settlement = exerciseAmount + optionFee;
var financialStatement = new FinancialStatement
{
AbstractTye = FinancialVoucherAbstractEnum.MaturityInvestmentIncome.GetHashCode(),
Abstract = $"确认期权到期投资收益({contractCode}",
IsSamePeer = isSamePeer
};
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "衍生工具/期权/场外期权/卖权/成本",
DebitOrCredit = 0,
DataField = optionFee,
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/卖权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 1,
DataField = optionFee,
Remark = ""
});
if (Math.Abs(settlement) > 0)
{
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/卖权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 0,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应付款/应付单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 1,
DataField = -Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "其他应收款/应收单位款",
SupplementaryAcountingUnit = clientName,
DebitOrCredit = 0,
DataField = Math.Abs(settlement),
Remark = ""
});
financialStatement.Children.Add(new FinancialStatement
{
AccountingSubject = "投资收益/衍生工具/期权/场外期权/卖权",
SupplementaryAcountingUnit = "场外衍生品部",
DebitOrCredit = 1,
DataField = Math.Abs(settlement),
Remark = ""
});
}
return financialStatement;
}
}
}
}
}