if set('1-F').contains([covered @concept.local-name ='FormType']) if first(list([covered @ferc:StatementOfRetainedEarningsMajorNonmajor])) == "Major" true else false else true
taxonomy().concept(ferc:RespondentLegalName).label("http://ferc.gov/form/2020-01-01/roles/label/F1Header").text Name of Respondent:

[@ferc:RespondentLegalName @period=$currentDuration] Duke Energy Kentucky, Inc.
taxonomy().concept(ferc:SubmissionType).label("http://ferc.gov/form/2020-01-01/roles/label/F1Header").text This report is:
(1) if missing({covered @concept=ferc:SubmissionType}) ☐ An Original']]> else if [@concept=ferc:SubmissionType @period=$currentDuration] == "O" ☑ An Original']]> else ☐ An Original']]> An Original
(2) if missing([covered @concept=ferc:SubmissionType @period=$currentDuration]) ☐ A Resubmission']]> else if [@concept=ferc:SubmissionType @period=$currentDuration] == "R" ☑ A Resubmission']]> else ☐ A Resubmission']]> A Resubmission
taxonomy().concept(ferc:ReportDate).label("http://ferc.gov/form/2020-01-01/roles/label/F1Header").text Date of Report:

[@ferc:ReportDate @period=$currentDuration] 04/26/2019
taxonomy().concept(ferc:ReportYearPeriod).label("http://ferc.gov/form/2020-01-01/roles/label/F1Header").text Year/Period of Report:

End of: [@ferc:ReportYear @period=$currentDuration] 2018 / [@ferc:ReportPeriod @period=$currentDuration] Q4
$treeElements = navigate parent-child descendants from ferc:RetainedEarningsLineItems role "http://ferc.gov/form/2020-01-01/roles/Schedule/F1/RetainedEarnings" where not $relationship.target-name.local-name.contains("AccountAffected") returns list (target, preferred-label, result-order); $data-labels = list(for $row in $treeElements $concept = $row[1]; $row_num = (filter $concept.references("http://ferc.gov/form/2020-01-01/roles/reference/formLocation") where ($item.part-by-name(ferc-part:Schedule).part-value == "118 - Schedule - Retained Earnings" and $item.part-by-name(ferc-part:ValueType).part-value.string == "Label" and "http://ferc.gov/form/2020-01-01/roles/label/" + $item.part-by-name(ferc-part:ColumnName).part-value.string == $row[2].role.uri)).to-list; $conceptPeriod = $concept.period-type; $conceptType = $concept.data-type.name.local-name; $beginningBalance = if $row[2].role.uri == "http://ferc.gov/form/2020-01-01/roles/label/F1BeginningBalance" true else false $beginningRow = if ($row_num.part-by-name(ferc-part:Row)).length > 0 min(($row_num.part-by-name(ferc-part:Row)).part-value) else "" $endingRow = if ($row_num.part-by-name(ferc-part:Row)).length > 0 max(($row_num.part-by-name(ferc-part:Row)).part-value) else "" $contraAccount = if $concept.name == ferc:TransfersFromUnappropriatedUndistributedSubsidiaryEarnings first(list([covered @concept = ferc:TransfersFromUnappropriatedUndistributedSubsidiaryEarningsContraPrimaryAccountAffected @unit @period=$currentDuration])) else none $current = if $conceptType == "monetaryItemType" if $conceptPeriod == "duration" if list([covered @concept = $row[1] @period = $currentDuration]).length > 0 first(list([covered @concept = $row[1] @period = $currentDuration])) else none else if $beginningBalance if list([covered @concept = $row[1] @period = $priorInstant]).length > 0 first(list([covered @concept = $row[1] @period = $priorInstant])) else none else if list([covered @concept = $row[1] @period = $currentInstant]).length > 0 first(list([covered @concept = $row[1] @period = $currentInstant])) else none else none $prior = if $conceptType == "monetaryItemType" if $conceptPeriod == "duration" if list([covered @concept = $row[1] @period = $priorDuration]).length > 0 first(list([covered @concept = $row[1] @period = $priorDuration])) else none else if $beginningBalance if list([covered @concept = $row[1] @period = $prior2Instant]).length > 0 first(list([covered @concept = $row[1] @period = $prior2Instant])) else none else if list([covered @concept = $row[1] @period = $prior12MonthsInstant]).length > 0 first(list([covered @concept = $row[1] @period = $prior12MonthsInstant])) else none else none $sequenceReferences = (filter $concept.references("http://ferc.gov/form/2020-01-01/roles/reference/elementSequence") where ($item.part-by-name(ferc-part:ScheduleRole).part-value == "http://ferc.gov/form/2020-01-01/roles/Schedule/F1/RetainedEarnings") returns $item.part-by-name(ferc-part:SequenceRole).part-value).to-list; /*** $breakdown = list($sequenceReferences.to-list);***/ $breakdown = list( if $sequenceReferences.to-list.length > 0 $sequenceRole = $sequenceReferences[1]; $sequenceElements = navigate parent-child descendants role $sequenceRole returns list(target, preferred-label, result-order); $axis = first(list(for $a in $sequenceElements if $a.length > 0 $conceptRoll = $a[1]; if $conceptRoll.substitution.local-name == "dimensionItem" $conceptRoll else skip else skip)); $lineItemsList = list(for $l in $sequenceElements if $l.length > 0 $conceptRoll = $l[1]; if $conceptRoll.is-abstract skip else $l else skip ); $data1 = list({covered {list( if exists({@ferc:OrderNumber @unit=* @period = $currentDuration where $fact.dimension($axis) != none}) first(list({@ferc:OrderNumber @unit=* @period = $currentDuration where $fact.dimension($axis) != none})) else 0, if $beginningBalance $beginningRow else $endingRow, $lineItemsList[3][1], if exists({@concept = $lineItemsList[2][1] @unit @period = $currentDuration where $fact.dimension($axis) != none}) first(list({@concept = $lineItemsList[2][1] @unit @period = $currentDuration where $fact.dimension($axis) != none})) else none, if exists({@concept = $lineItemsList[4][1] @unit @period = $currentDuration where $fact.dimension($axis) != none} ) first(list({@concept = $lineItemsList[4][1] @unit @period = $currentDuration where $fact.dimension($axis) != none})) else none, if exists({@concept = $lineItemsList[3][1] @unit @period = $currentDuration where $fact.dimension($axis) != none} ) first(list({@concept = $lineItemsList[3][1] @unit @period = $currentDuration where $fact.dimension($axis) != none})) else none, if exists({@concept = $lineItemsList[3][1] @unit=* @period = $priorDuration where $fact.dimension($axis) != none}) first(list({@concept = $lineItemsList[3][1] @unit=* @period = $priorDuration where $fact.dimension($axis) != none})) else none )}}); $data2 = list(for $x in $data1 if $x == list(0,$x[2],$x[3],none,none,none, none) skip else $x); $orders = set(for $x in $data2 $x[1]).sort; $orderedData = list(for $order in $orders for $row in $data2 if $row[1] != $order skip else $row ); $data = list(for $z in range($orderedData.length) $updatedNumber = $orderedData[$z][2].string + "." + $z.string; list($orderedData[$z][1],$updatedNumber,$orderedData[$z][3],$orderedData[$z][4],$orderedData[$z][5],$orderedData[$z][6],$orderedData[$z][7]) ); for $row in $data $row else skip ); list(list( 0, if $beginningBalance $beginningRow else $endingRow, $concept, $concept.label($row[2].role.uri).text, $contraAccount, $current, $prior )) + $breakdown ); for $rows in $data-labels for $rowl in $rows
taxonomy().concept(ferc:ScheduleRetainedEarningsAbstract).label("http://ferc.gov/form/2020-01-01/roles/label/F1ScheduleTitle").text Statement of Retained Earnings
taxonomy().concept(ferc:ScheduleRetainedEarningsAbstract).label("http://ferc.gov/form/2020-01-01/roles/label/F1Instructions").text
  1. Do not report Lines 49-53 on the quarterly version.
  2. Report all changes in appropriated retained earnings, unappropriated retained earnings, year to date, and unappropriated undistributed subsidiary earnings for the year.
  3. Each credit and debit during the year should be identified as to the retained earnings account in which recorded (Accounts 433, 436 - 439 inclusive). Show the contra primary account affected in column (b).
  4. State the purpose and amount of each reservation or appropriation of retained earnings.
  5. List first account 439, Adjustments to Retained Earnings, reflecting adjustments to the opening balance of retained earnings. Follow by credit, then debit items in that order.
  6. Show dividends for each class and series of capital stock.
  7. Show separately the State and Federal income tax effect of items shown in account 439, Adjustments to Retained Earnings.
  8. Explain in a footnote the basis for determining the amount reserved or appropriated. If such reservation or appropriation is to be recurrent, state the number and annual amounts to be reserved or appropriated as well as the totals eventually to be accumulated.
  9. If any notes appearing in the report to stockholders are applicable to this statement, include them on pages 122-123.
Line No. $headings = filter (taxonomy().concept(ferc:ScheduleRetainedEarningsAbstract).references("http://ferc.gov/form/2020-01-01/roles/reference/columnDetails")) where ($item.part-by-name(ferc-part:Schedule).part-value == "118 - Schedule - Retained Earnings") $headings = list(for $ref in $headings list($ref.part-by-name(ferc-part:Column).part-value, $ref.part-by-name(ferc-part:ColumnName).part-value)) $heading_dict = dict(for $row in $headings list("("+$row[1]+")",$row[2]) ); for $row in $heading_dict.keys.sort
$heading_dict[$row] Item
$row (a)
$rowl[2] 1
$rowl[3].name.local-name
$rowl[4] if $rowl[3].is-abstract "title" else "" if $rowl[4].is-fact "true" else "false" Net Cash Flow from Operating Activities
$rowl[6] if $rowl[3].is-abstract "gray-out" else "" 300 $rowl[7] if $rowl[3].is-abstract "gray-out" else "" 300