The past tense of the general subjunctive in German (Konjunktiv II) is similar to the past perfect: both use a form of one of the helping verbs (sein or haben) in second position with a past participle of the main verb at the end of the sentence or clause (in regular word order). Look at the following examples:
Er hatte seine Arbeit nicht gemacht. (past perfect)
Er hätte seine Arbeit nicht gemacht. (past subjunctive)
In the first sentence, “He had not done his work,” but, in the second one, we translate it as “He would not have done his work.” The only difference in the structure in German is the use of the subjunctive form of the helping verb, which we already know from the present tense subjunctive (e.g. hätte, wäre).
Sie ist gestern Abend ins Restaurant gegangen. (present perfect)
She went to a restaurant yesterday evening.
Sie wäre gestern Abend ins Restaurant gegangen, aber sie musste arbeiten. (past subjunctive)
She would have gone to a restaurant yesterday evening, but she had to work.
The key distinction in the past form is that würden cannot be used, and modal verbs use a double infinitive form. For example,
Wir könnten die Arbeit machen. (present subjunctive)
We could do the work.
Wir hätten die Arbeit machen können. (past subjunctive)
We could have done the work.
Note that, in the past subjunctive, the subjunctive form of the helping verb is used, but the modal verb is pushed to the end (after the main verb) in its infinitive form. The translation for the second sentence is: “We could have done the work.” When dependent word order is used (e.g. after a subordinating conjunction), just like the double infinitive form of the present perfect, the conjugated helping verb immediately precedes the double infinitive:
Ich weiß, dass wir die Arbeit hätten machen können.
I know that we could have done the work.