using YLErp.Model.Enum; namespace YLErp.Model.FinancialVoucherCreator { public class TerminationInvestmentIncomeGenerator { public static FinancialStatement GetFinancialStatement(bool isSamePeer, string clientName, bool isBuy, string contractCode, double optionFee, double unwindFee) { if (isSamePeer) { if (isBuy) { var settlement = unwindFee - optionFee; var financialStatement = new FinancialStatement { AbstractTye = FinancialVoucherAbstractEnum.TerminationInvestmentIncome.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 = unwindFee + optionFee; var financialStatement = new FinancialStatement { AbstractTye = FinancialVoucherAbstractEnum.TerminationInvestmentIncome.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 = unwindFee - optionFee; var financialStatement = new FinancialStatement { AbstractTye = FinancialVoucherAbstractEnum.TerminationInvestmentIncome.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 = "" }); 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 = unwindFee + optionFee; var financialStatement = new FinancialStatement { AbstractTye = FinancialVoucherAbstractEnum.TerminationInvestmentIncome.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 = "" }); 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; } } } } }